I want to add the current date to a database. My code is below:
mysql_query("insert into logfile(category, productname, filter, Position) values('$Category', '$SubCategory', '$Product', '$Position')");
How can I modify that to add a date?
I pulled this off of the phpfreaks.com forums:
FIELD date_added TYPE date
then, in the php code -
$Query="INSERT INTO $TableName ( field1, field2.... date_added ) VALUES ('$field1', '$field2', ... curdate() )";
Thanks!
How can I add the current time to a Time field?
http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html
There's an extensive list of MySQL functions for date and time. I was just browsing through and I think you'll find all the answers there.
Good luck!