RE: [PHP-DB] functions as default value

From: Date: Mon, 28 Apr 2003 09:11:00 +0000
Subject: RE: [PHP-DB] functions as default value
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-27400@lists.php.net to get a copy of this message
> If I want the default value of a date column to be the current date, is > there a way to use the function CURDATE() as the default, or do I need to > check with PHP (the data is being entered via a PHP form) if the date has > been entered and if not insert CURDATE() as the value? > > The question is whether I can set up the table to do this work for me, or > if I need to program the insert script to check this. Use a TIMESTAMP field. Its default is the current date/time. Other than that, no, you must have a constant as a default value. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.db (#27400) next »