将值插入MySql中的表时出错

时间:2014-10-22 01:06:29

标签: php mysql

我在mysql中向数据库表中插入值时出错。连接正常。我检查了一下。我的代码是:

$emails = implode(",", $not_submitted);

$sql_update_query = "INSERT INTO reminders_table(id,group_name,runtimes,emails) VALUES(NULL, '".mysql_real_escape_string($group_name) ."' ,'".mysql_real_escape_string($runtimes) ."' , '".mysql_real_escape_string($emails) ."')";

mysql_query(sql_update_query, $con);
echo $sql_update_query, "<br>"; 
echo mysql_error(), "<br>";

在我的控制台中看到错误后,它说:

"responseText: "INSERT INTO reminders_table(id,group_name,runtimes,emails) VALUES(NULL, 'BIT' , 'tue,wed-02:45,23:15' , 'c_faw,)<br>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 'sql_update_query' at line 1<br>"Reminders have been sent....! Please close this page."↵"

感谢任何帮助。到目前为止,我已经尝试了很多调试。我也添加了“mysql_real_escape_string”,但它仍然不起作用。

1 个答案:

答案 0 :(得分:1)

在电子邮件变量之后缺少单引号。