Jump to content

MySQL function need onupdate?????


judd48

Recommended Posts

Hello all,

Im making a site and i need a column in the database that is set to update itself to the curreent time every tie that row is altered ive been looking around and all i could dig up was OnUpdate() and i cant seem to find out how to use this anyone got an idea???

Link to comment
Share on other sites

In theory, you the first TIMESTAMP column in table automatically gets updated with the current date/time whenever a new row is inserted/updated without its value being specified explicity. However, in practice, I think it's a terrible idea -- it's much simpler to just include "NOW()" in your INSERT/UPDATE query, and it allows you to have a proper DATETIME column as well. They did make some minor improvements in MySQL 5, but it's still a bad idea. Go the easy route, no fancy columns, easy SQL statements to achieve your goal.

 

Hope that helps.

Link to comment
Share on other sites

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.