Mystixs Posted June 2, 2007 Share Posted June 2, 2007 How do I insert the System Date into a database when a script is run? I am not sure how to even retrieve the current date... Link to comment Share on other sites More sharing options...
teng84 Posted June 2, 2007 Share Posted June 2, 2007 use the mysql function "now()" or the php function for date like"date (parameters here)" Link to comment Share on other sites More sharing options...
Mystixs Posted June 2, 2007 Author Share Posted June 2, 2007 $date=mysql_real_escape_string(date('m, d, Y'));mysql_query("INSERT INTO animecat (lastupdated) VALUES ($date)");I have this but it doesn't work...Any idea whats wrong? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 4, 2007 Share Posted June 4, 2007 What data type is the lastupdated column? Link to comment Share on other sites More sharing options...
Mystixs Posted June 4, 2007 Author Share Posted June 4, 2007 It's "date" Link to comment Share on other sites More sharing options...
justsomeguy Posted June 4, 2007 Share Posted June 4, 2007 I would recommend that you change it to an integer and save the result of the PHP time() function, which is an integer timestamp. You can send the timestamp to the PHP date function to format it into a human-readable date, but I always store dates in a database as integer timestamps, it makes sorting and calculation really easy. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.