kev wood Posted March 5, 2009 Share Posted March 5, 2009 i have this line of code which i cannot see a problem with but i keep getting an error. $sql= "INSERT INTO emails (Firstname, Lastname, email, table) VALUES ('$a', '$b', '$c', '$table')"; the error i keep getting is Error: You have an error in your SQL syntax near 'table) VALUES ('kevin', 'wood', 'kevin_wood@xxxxxxxx', 'news')' at line 1 the values are being passed to this page fine but it still gives me this error. any help would be much appreciated. Link to comment https://forums.phpfreaks.com/topic/148063-solved-syntax-error/ Share on other sites More sharing options...
kickstart Posted March 5, 2009 Share Posted March 5, 2009 Hi Think table is a reserved word, hence issues with a column called table. All the best Keith Link to comment https://forums.phpfreaks.com/topic/148063-solved-syntax-error/#findComment-777150 Share on other sites More sharing options...
jackpf Posted March 5, 2009 Share Posted March 5, 2009 You can wrap reserved words in a ` and it'll be fine. You also need to do this for column names with spaces in etc... I always do it just be sure. It's good practice Link to comment https://forums.phpfreaks.com/topic/148063-solved-syntax-error/#findComment-777155 Share on other sites More sharing options...
kev wood Posted March 5, 2009 Author Share Posted March 5, 2009 thanks for the reply i didnt realise that it was a reserved word i was looking for missing semi colons. well it is done now thank you again Link to comment https://forums.phpfreaks.com/topic/148063-solved-syntax-error/#findComment-777156 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.