RyuHendrabusa Posted June 19, 2009 Share Posted June 19, 2009 Hello all, I just joined this forum because I am a beginner in php programming Need to ask the seniors here on how to get the latest update time to a particular field in MYSQL database. What I had in mind was to create a field last_update in my users table, then use this field to find out the last updated time. Being a total beginner at PHP and I need to complete this task for a job, it'll be really nice to get help on how can I go about accomplishing this task. Thanks a lot everyone Link to comment https://forums.phpfreaks.com/topic/162859-getting-the-latest-update-time/ Share on other sites More sharing options...
ohdang888 Posted June 19, 2009 Share Posted June 19, 2009 MySql UPDATE and SELECT statements http://www.tizag.com/mysqlTutorial/mysqlupdate.php Link to comment https://forums.phpfreaks.com/topic/162859-getting-the-latest-update-time/#findComment-859361 Share on other sites More sharing options...
PFMaBiSmAd Posted June 19, 2009 Share Posted June 19, 2009 http://dev.mysql.com/doc/refman/5.0/en/timestamp.html If you define a column as a mysql TIMESTAMP data type, it can be defined to be set to the current datetime on an INSERT or an UPDATE. Link to comment https://forums.phpfreaks.com/topic/162859-getting-the-latest-update-time/#findComment-859367 Share on other sites More sharing options...
RyuHendrabusa Posted June 19, 2009 Author Share Posted June 19, 2009 http://dev.mysql.com/doc/refman/5.0/en/timestamp.html If you define a column as a mysql TIMESTAMP data type, it can be defined to be set to the current datetime on an INSERT or an UPDATE. Thanks for helpin a noobie out! Is there anyway for me to make this TIMESTAMP column monitors only when one particular field gets updated? I have a contribution points column in my table and I want to keep track of the contribution points a member has made, and if it is recent, I would not fire off the queries again. Link to comment https://forums.phpfreaks.com/topic/162859-getting-the-latest-update-time/#findComment-859379 Share on other sites More sharing options...
Ken2k7 Posted June 19, 2009 Share Posted June 19, 2009 Is there anyway for me to make this TIMESTAMP column monitors only when one particular field gets updated? I have a contribution points column in my table and I want to keep track of the contribution points a member has made, and if it is recent, I would not fire off the queries again. Uh... say what? ??? Link to comment https://forums.phpfreaks.com/topic/162859-getting-the-latest-update-time/#findComment-859406 Share on other sites More sharing options...
PFMaBiSmAd Posted June 19, 2009 Share Posted June 19, 2009 If you have conditions that are different from the built-in cases where you want to update the value, you will need to use a DATETIME data type and specifically set it to a value in the UPDATE query only when you want. Link to comment https://forums.phpfreaks.com/topic/162859-getting-the-latest-update-time/#findComment-859429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.