简体   繁体   中英

Error inserting values to a table in MySql

I am having error inserting values to a database table in mysql.The connection is allright. I have checked it. My code is :

$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>";

After seeing the error in my console, it says :

"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."↵"

Any help is appreciated. So far I have tried debugging a lot. I added "mysql_real_escape_string" also, but still it doesn't work.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM