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. Link to comment https://forums.phpfreaks.com/topic/99642-solved-error-in-your-sql-syntax-need-help/ Share on other sites More sharing options...
zenag Posted April 5, 2008 Share Posted April 5, 2008 can u shw ur database struct.. Link to comment https://forums.phpfreaks.com/topic/99642-solved-error-in-your-sql-syntax-need-help/#findComment-509742 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 Link to comment https://forums.phpfreaks.com/topic/99642-solved-error-in-your-sql-syntax-need-help/#findComment-509744 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) Link to comment https://forums.phpfreaks.com/topic/99642-solved-error-in-your-sql-syntax-need-help/#findComment-509756 Share on other sites More sharing options...
zepher2 Posted April 5, 2008 Author Share Posted April 5, 2008 Thanks - it works fine now. Link to comment https://forums.phpfreaks.com/topic/99642-solved-error-in-your-sql-syntax-need-help/#findComment-509758 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.