judd48 Posted January 7, 2006 Share Posted January 7, 2006 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??? Quote Link to comment https://forums.phpfreaks.com/topic/3162-mysql-function-need-onupdate/ Share on other sites More sharing options...
fenway Posted January 7, 2006 Share Posted January 7, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/3162-mysql-function-need-onupdate/#findComment-10718 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.