Hello, I hope somebody can point me in the right direction because I've been struggling with this for hour and searched everywhere on the forums and the web...
I am trying to enter some data into a WordPress table and I keep getting a syntax error that has something to do with the date.
I have converted my date to a gmt date and my $gmt_date variable contains the following value:
2007-11-07 00:00:00
I am trying to store this value in the field post_date (which is a datetime filed). I am looking at the database via phpMyAdmin and I see that the dates are stored in that same Y-m-d H:i:s fashion (for example I posted something via WP today and I see the date of that post is 2010-04-21 16:00:39).
It seems straight forward to me but I keep getting an error saying:
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 '05:00:00)' at line 2
In order to troubleshoot the problem I have simplified my query to this:
mysql_query("INSERT INTO wp_posts (post_date) VALUES($gmt_date) ") or die(mysql_error());
and I still get that error with this simple query!
How can I enter a date in the past into a datetime field of a MySQL database???
Hope somebody can help me!
Thanks