Jump to content

[SOLVED] Get all entries from today (mysql)


rotwyla98

Recommended Posts

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

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.

Archived

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

×
×
  • Create New...

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.