Is there a simple way to activate a timestamp in MySQL without passing a variable from the php script? What I want to do is have a timestamp field in the database which (NOW)'s every time a new record is added.
serambin wrote:Is there a simple way to activate a timestamp in MySQL without passing a variable from the php script? What I want to do is have a timestamp field in the database which (NOW)'s every time a new record is added.
Thanks,
Stan
Create a column TIMESTAMP. It will be updated every time you do some modification to the record. Read the manual!
I was using a Timestamp(14) without being specified explicitly in an INSERT or LOAD DATA INFILE statement. However, when setting up the field in MySQLAdmin, the column was set to null even after I 'appeared' to have sucessfully changed it to non null (even deleted and recreated). That's why I was looking for another solution. I finally am using datetime and setting it in the code explicitly.