very new to PHP trying to insert datetime into mysql
Posted: Wed Jan 06, 2010 8:41 pm
Hi,
I am using MySQL, PHP, Apache on a windows platform. I am tryint to insert the date into a MySQL table. I can not use the NOW() function because I need to add it via PHP, not the query.
My table field is set to datetime and I am entering it via this:
When I look at the field, I see that it is: 0000-00-00 00:00:00
If I change the field to text and execute the code, I see that it is: 2010
I am more used to ASP and Access database where it is very easy to do this but can someone help me insert a date into the MySQL database? Thanks
I am using MySQL, PHP, Apache on a windows platform. I am tryint to insert the date into a MySQL table. I can not use the NOW() function because I need to add it via PHP, not the query.
My table field is set to datetime and I am entering it via this:
Code: Select all
(isset($_POST['soldselect'])?date("Y-m-d h:m:s"):null) If I change the field to text and execute the code, I see that it is: 2010
I am more used to ASP and Access database where it is very easy to do this but can someone help me insert a date into the MySQL database? Thanks