Looktrne Posted June 29, 2008 Share Posted June 29, 2008 I cant see the error in this syntax? mysql_query("INSERT INTO brain (mail, is) VALUES ('$email[0]', '1')")or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/112428-solved-error-in-mysql-sytanx/ Share on other sites More sharing options...
MasterACE14 Posted June 29, 2008 Share Posted June 29, 2008 this part right here... '$email[0]' it needs to be $email['0'] . However, I believe that will conflict with the other comma's you can do it this way... <?php $email = $email['0'] mysql_query("INSERT INTO brain (mail, is) VALUES ('$email', '1')")or die(mysql_error()); that will work. Quote Link to comment https://forums.phpfreaks.com/topic/112428-solved-error-in-mysql-sytanx/#findComment-577185 Share on other sites More sharing options...
Looktrne Posted June 29, 2008 Author Share Posted June 29, 2008 I changed it to this mysql_query("INSERT INTO brain (mail, is) VALUES ('$ie', '1')")or die(mysql_error()); still getting error message: 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 'is) VALUES ('info@noname.com', '1')' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/112428-solved-error-in-mysql-sytanx/#findComment-577187 Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 The word 'is' a reserved word in MySQL and cannot be used as a table column or name as it is always interpeted as MySQL keyword like SELECT or IF or NOT etc. Recreate the table changing that column name and the query should run fine. Quote Link to comment https://forums.phpfreaks.com/topic/112428-solved-error-in-mysql-sytanx/#findComment-577189 Share on other sites More sharing options...
Looktrne Posted June 29, 2008 Author Share Posted June 29, 2008 wow you are the best.. Quote Link to comment https://forums.phpfreaks.com/topic/112428-solved-error-in-mysql-sytanx/#findComment-577206 Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 Anytime mate. When the thread is solved could you please click the 'Topic Solved' link at the bottom. It just speeds up finding threads that still need solving making the forum better and more productive for everyone Quote Link to comment https://forums.phpfreaks.com/topic/112428-solved-error-in-mysql-sytanx/#findComment-577326 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.