Trouble with INSERT

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
kyoru
Forum Commoner
Posts: 26
Joined: Mon Feb 13, 2006 9:35 pm

Trouble with INSERT

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

"order" is a reserved word.

backtick each of the column names.
Post Reply