$update_sql = "UPDATE guestbook SET reply = '$reply', replytime = $replytime WHERE id = $_POST[id]";报错提示:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
7 回答
已采纳
wcysky
TA贡献2条经验 获得超0个赞
SQL语句改下 $update_sql = "UPDATE guestbook SET reply = '".$reply."', replytime = $replytime WHERE id = $_POST[id]";
单引号不解析php变量,被当做字符串了
mooc用户18273
TA贡献50条经验 获得超30个赞
$update_sql = "UPDATE guestbook SET reply = '{$reply}', replytime = {$replytime} WHERE id = {$_POST[id]}";
试一下
青年賣魚丸
TA贡献1条经验 获得超0个赞
$update_sql = "UPDATE guestbook SET reply = '" . mysql_real_escape_string($reply). "', replytime = '$replytime' WHERE id = {$_POST['id']}";
泥豆芽儿MT
TA贡献2条经验 获得超0个赞
$update_sql = "UPDATE guestbook SET reply = '$reply', replytime = $replytime WHERE id = $_POST[id]";
改成 $update_sql = "UPDATE guestbook SET reply = “.$reply.", replytime = ".$replytime."WHERE id = ".$_POST[id]; 试试看
添加回答
举报
0/150
提交
取消