This topic is locked

using TIMESTAMP field

9/21/2009 8:31:54 AM
PHPRunner General questions
M
mlcprs author

Hi,
I'm trying to use a mySQL TIMESTAMP field to provide the date when the record was added.

This can be done by adding the record and providing no value for the timestamp field, so it gets its default NULL value.

However in phpRunner how can I do this? If no value is entered in the form it still supplies a value (possibly an empty string?). I've tried adding a "before record is added event"

$values["date_added"]="NULL";

or

$values["date_added"]=mysql_escape_string("NULL");

neither of which work.

Any suggestions, please?
Peter

J
Jane 9/21/2009

Peter,
you can remove date_added field from update query:

unset($values["date_added"]);



or fill it manually:

$values["date_added"] = now();
M
mlcprs author 9/21/2009



Peter,
you can remove date_added field from update query:

unset($values["date_added"]);



or fill it manually:

$values["date_added"] = now();



Thanks. Jane. The second option works, but I changed the field from mySQL timestamp to date type as the timestamp's now irrelevant.

The unset didn't work, but you've solved my problem.

Thanks,
Peter