You also have the option of changing the column type to TIMESTAMP. With a TIMESTAMP column you don't have to do anything to get it to update automatically. Just do an INSERT into the table and the column will be updated automatically. Here's a snippet, but check the full MySQL documentation for more information.: "Automatic updating of the TIMESTAMP column occurs under any of the following conditions: The column is not specied explicitly in an INSERT or LOAD DATA INFILE statement. The column is not specied explicitly in an UPDATE statement and some other column changes value. (Note that an UPDATE that sets a column to the value it already has will not cause the TIMESTAMP column to be updated, because if you set a column to its current value, MySQL ignores the update for efficiency.) You explicitly set the TIMESTAMP column to NULL." > -----Original Message----- > From: ..: GamCo :.. Gawie Marais [mailto:gawie@xxxxxxxxx] > Sent: Thursday, March 04, 2004 8:35 AM > To: php-db@xxxxxxxxxxxxx > Subject: Php datetime > > > hi, > > i have created a mysql table where i would like to store the > date and time > whenever a user logs into a web site. the login is done > through php/mysql as > well but i'm not sure what the php code is to add the current > date/time into > a mysql database. the field in the db is created as a > 'datetime' field. > > > > > > > > > > Regards, > > > Gawie Marais > ..: GamCo :.. > > -------------------------------------- > Tel: +27 11 312 0481 > Fax: +27 11 312 0483 / +27 82 239 2986 > http://www.gam.co.za > -------------------------------------- > if(empty($beer)) > { getbeer() } > else > { consume($beer) } > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php