conan318 Posted February 6, 2012 Share Posted February 6, 2012 all was working in till i added the last 3 items into the query. lock,pri,high. all 3 variables echo out the right value. remove the last 3 works fine. 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 'lock,pri,high) VALUES ('tom@mydomain','tom','logo Design','add add'' at line 1 $result=mysql_query("INSERT INTO listing (email,listing_name,listing_type,listing_description,budget,ivn,link1,link2,link3,slide,slide2,slide3,slide4,slide5,slide6,expiredate,zip,lock,pri,high) VALUES ('$email','$listing_name','$dtype','$description','$budget','$inv2','$link1','$link2','$link3','$slide','$slide2','$slide3','$slide4','$slide5','$slide6','$newdate','$img','$lock','$pri','$high')") or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/256508-syntax-error/ Share on other sites More sharing options...
conan318 Posted February 6, 2012 Author Share Posted February 6, 2012 changed the table to invite and all is working now... notsure why it did like me using the word lock. $result=mysql_query("INSERT INTO listing (email,listing_name,listing_type,listing_description,budget,ivn,link1,link2,link3,slide,slide2,slide3,slide4,slide5,slide6,expiredate,zip,pri,high,invite) VALUES ('$email','$listing_name','$dtype','$description','$budget','$inv2','$link1','$link2','$link3','$slide','$slide2','$slide3','$slide4','$slide5','$slide6','$newdate','$img','$pri','$high','$invite')") or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/256508-syntax-error/#findComment-1314934 Share on other sites More sharing options...
trq Posted February 6, 2012 Share Posted February 6, 2012 lock is a reserved word in mysql. Either change your column name or surround it with `backticks`. Quote Link to comment https://forums.phpfreaks.com/topic/256508-syntax-error/#findComment-1314936 Share on other sites More sharing options...
conan318 Posted February 6, 2012 Author Share Posted February 6, 2012 thanks for clearing that up. will lock that in the memory bank wasted hours looking for a syntax error lol Quote Link to comment https://forums.phpfreaks.com/topic/256508-syntax-error/#findComment-1315058 Share on other sites More sharing options...
AyKay47 Posted February 6, 2012 Share Posted February 6, 2012 you should familiarize yourself with the mysql reserved words so you do not run into this again. Quote Link to comment https://forums.phpfreaks.com/topic/256508-syntax-error/#findComment-1315074 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.