dragon_sa Posted January 27, 2011 Share Posted January 27, 2011 what happens now if you do $date = gmdate('Y-m-d h\:i\:s'); the problem is with the date or you could do this $date = gmdate('Y-m-d h.i.s'); Quote Link to comment Share on other sites More sharing options...
Bradley99 Posted January 27, 2011 Author Share Posted January 27, 2011 First Date: edition=1 - news=This is my article - title=Titlee - by=BradleyYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by, date) VALUES ('1', 'This is my article', 'Titlee', 'Bradley', '2011-01-27 03' at line 1 Second date: Same again. . . . Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 27, 2011 Share Posted January 27, 2011 The problem isn't likely the date as much as the fact that 'by' is a MySQL reserved word. You need to enclose it in `backticks` to use it as a table or field name. A good indication is the error message: for the right syntax to use near 'by, . . . Quote Link to comment Share on other sites More sharing options...
dragon_sa Posted January 27, 2011 Share Posted January 27, 2011 actually I remember having this problem before with an ordering system and the column name order, for simplicity I just changed the name of the column, on what Pikachu says it would be like this then for it to work $query =("INSERT INTO paper (edition, news, title, `by`, date) VALUES ('$edition', '$news', '$title', '$by', '$date')"); if that still causes issues consider changing the column by to another name Quote Link to comment Share on other sites More sharing options...
Bradley99 Posted January 27, 2011 Author Share Posted January 27, 2011 It was the by thing Working fine now, thanks guys!!!! 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.