ccrevcypsys Posted October 23, 2007 Share Posted October 23, 2007 Here is 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 'all,asia_pacific,EMEA,greater_china,latin_america,north_america,doc_type,title,a' at line 1 Here is the echo of where the error is: INSERT INTO newsdocs (region,all,asia_pacific,EMEA,greater_china,latin_america,north_america,doc_type,title,abstract,author,page_content,file,url,source,date,creator) VALUES ('0','','1','','1','','','','Test','Testing','Test Man','gasdfadf','','Test','','2007-10-23','altagroup') it was working before i added the all, asia_pacific, EMEA, greater_china, latin_america, north_america, but the thing is that those colmns are in the table. This makes no sence to me i am just trying to make it to where people can post news bulletons in more areas than one. The region column was the last one that i had but it only enabled for one region at a time. What is the best way or is this fixable? I am not to sure y it is not working. somone help heres the code for the insert <?php $db_to_form = array( "region" => "region", "all" => "all", "asia_pacific" => "asia_pacific", "EMEA" => "EMEA", "greater_china" => "greater_china", "latin_america" => "latin_america", "north_america" => "north_america", "doc_type" => "doc_type", "title" => "title", "abstract" => "abstract", "author" => "author", "page_content" => "page_content", "file" => "filename", "url" => "url", "source" => "source"//, //"date" => "date" ); $ins_db_values .= "'". $_POST[$value]."',"; $create_this_sql = "INSERT INTO newsdocs (".$db_to_form.") VALUES (".$ins_db_values.")"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/74475-solved-why-am-i-getting-this-error/ Share on other sites More sharing options...
pocobueno1388 Posted October 23, 2007 Share Posted October 23, 2007 "all" is a MySQL reserved word. Try putting back ticks around it (`all`). Quote Link to comment https://forums.phpfreaks.com/topic/74475-solved-why-am-i-getting-this-error/#findComment-376341 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.