tauchai83 Posted January 14, 2007 Share Posted January 14, 2007 I recently use a script and I change all the table prefix tbl_product to product, then the order part did not work out as intended. I got the follwing 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(od_date, od_last_update, od_shipping_first_name, od_shipping_last_name, od' at line 1it's strange...nit any setting or anything wrong? because the sql is correct. My sql statement as follow:[color=purple]$sql = "INSERT INTO order(od_date, od_last_update, od_shipping_first_name, od_shipping_last_name, od_shipping_address1, od_shipping_address2, od_shipping_phone, od_shipping_state, od_shipping_city, od_shipping_postal_code, od_shipping_cost, od_payment_first_name, od_payment_last_name, od_payment_address1, od_payment_address2, od_payment_phone, od_payment_state, od_payment_city, od_payment_postal_code) VALUES (NOW(), NOW(), '$hidShippingFirstName', '$hidShippingLastName', '$hidShippingAddress1', '$hidShippingAddress2', '$hidShippingPhone', '$hidShippingState', '$hidShippingCity', '$hidShippingPostalCode', '$shippingCost', '$hidPaymentFirstName', '$hidPaymentLastName', '$hidPaymentAddress1', '$hidPaymentAddress2', '$hidPaymentPhone', '$hidPaymentState', '$hidPaymentCity', '$hidPaymentPostalCode')";[/color] Quote Link to comment Share on other sites More sharing options...
AndyB Posted January 14, 2007 Share Posted January 14, 2007 ORDER is a MySQL [b]reserved word[/b]. I bet you can't use reserved MySQL words as table names (or field names).http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html Quote Link to comment Share on other sites More sharing options...
tauchai83 Posted January 15, 2007 Author Share Posted January 15, 2007 Thanks a lot Andy!!! It works! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.