【发布时间】:2015-07-07 23:36:32
【问题描述】:
始终回答“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!';
}
【问题讨论】:
-
回显生成的 SQL 并在 PHPMyAdmin 或终端中自己运行它,您收到的错误消息将有助于确定失败的原因。
-
这可能意味着您甚至没有打开与数据库的连接...
-
我没有收到错误消息,我只收到消息“Terjadi kesalahan saat mengirim komen!”,我使用记事本++,我该怎么办?
-
我已经打开了我的连接,在此之前我给出了这个代码
-
$connection = mysql_connect("localhost","root",""); mysql_select_db("klimaks",$connection);