Page 1 of 1

now() in hidden form tag

Posted: Tue Aug 10, 2004 10:09 pm
by AliasBDI
I have a table with a TIMESTAMP field. I want it to update the TIMEDATE each time the record has an UPDATE. So I added a hidden input type tag and put <? now(); ?> in the value with the column name in the name. The php is giving me an error. Am I not doing this correctly?

MySQL db by the way.

Posted: Tue Aug 10, 2004 10:22 pm
by hawleyjr
now() is a myssql function. If you are looking to do this in php check out [php_man]mktime[/php_man] [php_man]date[/php_man] and [php_man]time[/php_man].


When I insert dates I use the following query:

Code: Select all

<?php
$qry = "INSERT INTO TBL_NAME(ID,DTTM) VALUES (1,now())";
?>

another question

Posted: Tue Aug 10, 2004 10:33 pm
by AliasBDI
Is there no way to declare it as a variable? Or call it from the server as a variable?

Posted: Tue Aug 10, 2004 10:42 pm
by hawleyjr
hawleyjr wrote: If you are looking to do this in php check out [php_man]mktime[/php_man] [php_man]date[/php_man] and [php_man]time[/php_man].

Posted: Tue Aug 10, 2004 10:55 pm
by feyd
the first timestamp field in your row will automatically update when you issue an update call.