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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.