zepher2 Posted April 5, 2008 Share Posted April 5, 2008 I am relatively inexperienced but am trying to insert data into my database. My code is as follows: // Insert a row of information into the table mysql_query("INSERT INTO Site_news (display, Date, News,) VALUES ('$display', '$date', '$news')") or die(mysql_error()); I get the following 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 ') VALUES ('Y', '2008-04-04', ' News upcoming Soon ')' at li I cannot see what I did wrong, can anyone help. Quote Link to comment Share on other sites More sharing options...
zenag Posted April 5, 2008 Share Posted April 5, 2008 can u shw ur database struct.. Quote Link to comment Share on other sites More sharing options...
zepher2 Posted April 5, 2008 Author Share Posted April 5, 2008 Table Name is Site_news Four fields ID - auto_increment display - char(1) Date - date News - Text Quote Link to comment Share on other sites More sharing options...
zenag Posted April 5, 2008 Share Posted April 5, 2008 remove comma after News mysql_query("INSERT INTO Site_news (display, Date, News,) as mysql_query("INSERT INTO Site_news (display, Date, News) Quote Link to comment Share on other sites More sharing options...
zepher2 Posted April 5, 2008 Author Share Posted April 5, 2008 Thanks - it works fine now. Quote Link to comment 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.