rwilmot1 Posted February 11, 2010 Share Posted February 11, 2010 Hi Guys, This is my first post so pleas be gentle I have only been coding PHP for the past month or so and have created a log diary. I have set up the fields and calendar entries as well as other bits and bobs. What I want to do now is call data from the mysql database but for records that were created in the past 12 hours, then another report for the past 24 hours, then 36 etc. I do have a timestamp entry in the mysql table. I hope that makes sense???! If it doesn't then I will try and provide more detailed info along with some code Link to comment https://forums.phpfreaks.com/topic/191769-selecting-data-from-mysql-for-past-12-hours-worth-of-records/ Share on other sites More sharing options...
sader Posted February 11, 2010 Share Posted February 11, 2010 well one simple way could be such as: SELECT * FROM `log` WHERE `time` > UNIX_TIMESTAMP() - 3600 * 12 SELECT * FROM `log` WHERE `time` > UNIX_TIMESTAMP() - 3600 * 24 SELECT * FROM `log` WHERE `time` > UNIX_TIMESTAMP() - 3600 * 36 Link to comment https://forums.phpfreaks.com/topic/191769-selecting-data-from-mysql-for-past-12-hours-worth-of-records/#findComment-1010758 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.