Jump to content

Archived

This topic is now archived and is closed to further replies.

judd48

MySQL function need onupdate?????

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???

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.