rotwyla98 Posted August 22, 2007 Share Posted August 22, 2007 I've been searching for hours and can't seem to find the answer. I currently have a page that each time a user visits it, the pageid and timestamp is thrown into a mysql daabase. so the database looks like so: linkid time 3 2007-08-22 17:26:21 3 2007-08-20 17:26:21 3 2007-08-22 18:36:59 2 2007-08-22 18:37:21 What i need is for php to show the total amount of visits today as per a certain time zone (or if thats not possible, the past 24 hours) soo.. Search for all occurrences where linkid = 3 today for a specific timezone (or 24 hours) MORE SPECIFICALLY User 1: Lives in New York (EST -5) registers for my site and sends visitors to his linkid (3) After two days, this is what the mysql table looks like: linkid time 3 -=- 2007-08-22 17:26:21 3 -=- 2007-08-20 17:26:21 3 -=- 2007-08-22 18:36:59 But mysql time isn't Eastern time, its another timezone. So when a visitor comes to user1's page at 3pm EST, mysql registers the time as 2007-08-22 17:26:21 So... I want to first add/subtract the number of numbers in the mysql database depending upon the user, and then see the amount of visitors for the day. Link to comment https://forums.phpfreaks.com/topic/66243-solved-get-all-entries-from-today-mysql/ Share on other sites More sharing options...
rotwyla98 Posted August 22, 2007 Author Share Posted August 22, 2007 In the last line, it should read "I want to first add/subtract the number of hours..." not "number of numbers" Link to comment https://forums.phpfreaks.com/topic/66243-solved-get-all-entries-from-today-mysql/#findComment-331332 Share on other sites More sharing options...
lemmin Posted August 22, 2007 Share Posted August 22, 2007 You can edit your posts by clicking modify, instead of posting a new one. "SELECT COUNT(linkid) FROM table WHERE linkid = 3 AND DATEDIFF(NOW(), time) = 0" That should return the number of entries within the last 24 hours. Link to comment https://forums.phpfreaks.com/topic/66243-solved-get-all-entries-from-today-mysql/#findComment-331336 Share on other sites More sharing options...
rotwyla98 Posted August 22, 2007 Author Share Posted August 22, 2007 You can edit your posts by clicking modify, instead of posting a new one. "SELECT COUNT(linkid) FROM table WHERE linkid = 3 AND DATEDIFF(NOW(), time) = 0" That should return the number of entries within the last 24 hours. beautiful. thanks loads. There is no modify button for my first post, I looked for it and couldn't find it. Link to comment https://forums.phpfreaks.com/topic/66243-solved-get-all-entries-from-today-mysql/#findComment-331356 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.