Page 1 of 1

Trouble with INSERT

Posted: Tue Mar 07, 2006 11:34 pm
by kyoru
Heres my php code..

Code: Select all

$query="INSERT INTO order_complete (id,order_id,shipping_info,billing_info,email,status,order,total)" . " VALUES ('NULL', '$sid', '$shipping_info','$billing_info','$email_code','new','$cart_main_output2','$session_order_amount')";
			mysql_query($query) or die(mysql_error());
So after i send the query, it fails...so i looked at the error..
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 'order,total) VALUES ('NULL', 'a7a43140eeafc54cd0a91075a2adb019'
so what could cause this error? the table order is the exact same as well... thank you so much

Posted: Wed Mar 08, 2006 12:03 am
by feyd
"order" is a reserved word.

backtick each of the column names.