Can't insert data into mysql database using PHP -


answer "terjadi kesalahan saat mengirim komen!". can me?

$message = mysql_real_escape_string(bbcode_to_html($message)); if (mysql_query('insert topics (id_parent, id, id_user, title, message, id_author, timestamp, timestamp_user) select "' . $dn1['id_parent'] . '", "' . $id . '", max(id_user)+1, "", "' . $message . '", "' . $_session['userid'] . '", "' . time() . '", "' . time() . '" topics id="' . $id . '"') , mysql_query('update topics set timestamp_user="' . time() . '" id="' . $id . '" , id_user=1')){     ?><header class="major">     komen sukses! kembali ke <a href="read_topic.php?id=<?php echo $id; ?>">topik!</a> </header> <?php }else{     echo 'terjadi kesalahan saat mengirim komen!'; } 

edited:

try adding code:

<?php $message = mysql_real_escape_string(bbcode_to_html($message));  $sqlquery1 = 'insert topics (id_parent, id, id_user, title, message, id_author, timestamp, timestamp_user) select "' . $dn1['id_parent'] . '", "' . $id . '", max(id_user)+1, "", "' . $message . '", "' . $_session['userid'] . '", "' . time() . '", "' . time() . '" topics id="' . $id . '"';  $sqlquery2 = 'update topics set timestamp_user="' . time() . '" id="' . $id . '" , id_user=1';  $result1 = mysql_query($sqlquery1) or die(mysql_error() . ": full query was: " . $sqlquery1);  $result2 = mysql_query($sqlquery2) or die(mysql_error() . ": full query was: " . $sqlquery2);  if ( $result1 , $result2){     ?><header class="major">     komen sukses! kembali ke <a href="read_topic.php?id=<?php echo $id; ?>">topik!</a> </header> <?php }else{     echo 'terjadi kesalahan saat mengirim komen!'; } ?> 

this show query tried execute. if want further questions answered well.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -