atticus Posted December 20, 2007 Share Posted December 20, 2007 I am getting syntax error for the following code. I can't seem to find the problem: Error, insert query failedYou 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 (cust_id, last_name, first_name, middle_name, suffix, address_1, address_2' at line 1 $query = "INSERT INTO order (cust_id, last_name, first_name, middle_name, suffix, address_1, address_2, city, state, zip, gender, race, dob, ssn, search_area_state, search_area_county, city_search, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, type_service, notes) VALUES ('$cust_id', '$last_name', '$first_name', '$middle_name', '$suffix', '$address1', '$address2', '$city', '$state', '$zip', '$gender', '$race', '$dob', '$ssn', '$search_area_state', '$search_area_county','$city_search', '$s1', '$s2', '$s3', '$s4', '$s5', '$s6', '$s7', '$s8', '$s9', '$s10', '$s11', '$s12', '$s13', '$s14', '$s15', '$type_service', '$notes');"; mysql_query($query) or die('Error, insert query failed' . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/82559-solved-mysql-insert-problem/ Share on other sites More sharing options...
revraz Posted December 20, 2007 Share Posted December 20, 2007 ORDER is a reserved word. Either use `backticks` or change it. Changing it would be better. Quote Link to comment https://forums.phpfreaks.com/topic/82559-solved-mysql-insert-problem/#findComment-419718 Share on other sites More sharing options...
Caesar Posted December 20, 2007 Share Posted December 20, 2007 Edit: Above feller beat me to it...use `ticks`. Quote Link to comment https://forums.phpfreaks.com/topic/82559-solved-mysql-insert-problem/#findComment-419720 Share on other sites More sharing options...
atticus Posted December 20, 2007 Author Share Posted December 20, 2007 thanks...I have never tried to change the name of a table in phpmyadmin and I don't see how. The back ticks aren't making a difference Quote Link to comment https://forums.phpfreaks.com/topic/82559-solved-mysql-insert-problem/#findComment-419725 Share on other sites More sharing options...
revraz Posted December 20, 2007 Share Posted December 20, 2007 Post the updated code Quote Link to comment https://forums.phpfreaks.com/topic/82559-solved-mysql-insert-problem/#findComment-419727 Share on other sites More sharing options...
revraz Posted December 20, 2007 Share Posted December 20, 2007 You can use the ALTER sql function to change it. http://dev.mysql.com/doc/refman/5.0/en/alter-table.html Quote Link to comment https://forums.phpfreaks.com/topic/82559-solved-mysql-insert-problem/#findComment-419729 Share on other sites More sharing options...
atticus Posted December 20, 2007 Author Share Posted December 20, 2007 I found the alter command...appreciate it everybody Quote Link to comment https://forums.phpfreaks.com/topic/82559-solved-mysql-insert-problem/#findComment-419730 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.