Jump to content

[SOLVED] What do you us whenever you need to assign a modified time/date stamp to a mysql


Recommended Posts

well I thought it was simple but I have a record in my database that I want to reflect modification date and time, I have a field called LastMod, anytime I modify a record this field is updated along with the rest of the fields in the update script to show when something was modified.

If you create a DATETIME file in a mysql table it is my understanding that this field is automatically updated whenever a change is made to the record that contains that field.  So really, if that is the case...you do not need a PHP function to give you the proper date and time.  Just create a field and make it of type DATETIME and then make a chance to the record and see if that field is updated automatically. 

 

Carlos

This type of logic is better left in the database and left out of PHP altogether.  If you read the MySQL documentation on the DATETIME and TIMESTAMP data types you'll find the information you need.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.