RE: functions as default value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux