总是回答“terjadi kesalahan saat mengirim komen!”。任何人都可以帮助我吗?
$message = mysql_real_escape_string(bbcode_to_html($message));
if (mysql_query('insert into 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() . '" from topics where id="' . $id . '"') and mysql_query('update topics set timestamp_user="' . time() . '" where id="' . $id . '" and 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!';
}
答案 0 :(得分:0)
编辑:
尝试添加此代码:
<?php
$message = mysql_real_escape_string(bbcode_to_html($message));
$sqlquery1 = 'insert into 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() . '" from topics where id="' . $id . '"';
$sqlquery2 = 'update topics set timestamp_user="' . time() . '" where id="' . $id . '" and 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 and $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!';
}
?>
现在,它还会显示您尝试执行的查询。如果您希望得到更好的答案,这将有所帮助。