PSN
PSN

Reputation: 99

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.

Upvotes: 0

Views: 42

Answers (1)

Rogerio Coelho
Rogerio Coelho

Reputation: 40

It a missing a Single quote after email variable.

Upvotes: 1

Related Questions