How would i insert today's date into a mysql? What i'm trying to accomplish is this
when a blank field ("Enter name") is filled out in a php form, the date it was created should be put in the mysql data automatically.
Thanks for the help in advance.
NOW()
$query = mysql_query("INSERT INTO your_table (name, todays_date) VALUES ('john doe', now())");
Cgraz
There is a better way, this format isn't very friendly Ordered search querys, but it works, and it's as far as I've got.
{$DateNow= date ("jS M Y - G:ia");// format 24th Dec 2002 - 21:34pm
Then insert $DateNow into the appropriate column in the db.
thanks for the help
Depends what you're doing with the date. I'd rather leave it in MySQL format, then pull it out formatted the way I want using DATE_FORMAT(). You leave your options open that way.
I used the now() function but its only putting year in the DB. The DB field is int(10), null=no, default=0
Do I need to change that?
Yeah, database field should be timestamp.
that fixed it.