MySQL Forums
Forum List  »  PHP

syntax error
Posted by: Leandro Tracchia
Date: June 30, 2005 08:15AM

I am trying to insert a row via php but I am getting the following syntax 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 (req_date, desired_date, requested_by, ship_via, additional_comments, tota' at line 1

The insert statement is this:

$query_order = "INSERT INTO order (req_date, desired_date, requested_by, ship_via, additional_comments, total_price) VALUES('$req_date', '$desired_date', '$requested_by', '$ship_via', '$additional_comments', $total_price);";

I get the variables from the $_POST array:

Array
(
[req_date] => Thursday 30th of June 2005 09:36:08 AM
[desired_date] => 10 July 2005
[requested_by] => Joe Smith
[vendor_name] => IBM
[vendor_address] => Something Dr.
[vendor_city] => Somewhere
[vendor_state] => CA
[vendor_zip] => 12345
[vendor_phone] => 234-423-1285
[vendor_fax] => 234-893-1253
[contact_name] => Somebody
[ship_via] => 2 Day
[additional_comments] => great service
[quantity1] => 4
[item_description1] => CPU Fan
[vendor_part_number1] => 78910987
[account_number1] => 123890-123
[price1] => 58.95
[subtotal_price1] => 235.8
[quantity2] => 2
[item_description2] => Keyboard Cleaner
[vendor_part_number2] => 91823712
[account_number2] => 78-902134
[price2] => 10.95
[subtotal_price2] => 21.9
[total_price] => 257.7
[confirm] => Confirm
)

and these are the datatypes from the table:

req_id int(10) unsigned not null auto_increment primary
req_date varchar(255)
desired_date varchar(255)
requested_by varchar(255)
ship_via varchar(255)
additional_comments varchar(255)
total_price decimal(10,2)

Any help on this would be greatly appreciated. My guess is that maybe there is a datatype conflict. I'm really clueless. Thanks.

LRT

Options: ReplyQuote


Subject
Written By
Posted
syntax error
June 30, 2005 08:15AM
mk
July 01, 2005 12:25AM
July 01, 2005 10:40AM
July 01, 2005 02:38PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.