Jump to content
MakeWebGames

Submit Query after somebody has been on the page for a certain amount of time


Recommended Posts

Posted

Hey, I'm in the middle of creating a website and i am stuck.

Basically, I have added a view count to a page so when a user clicks on a page, it submits a query to update the view count. Now the problem is that if people constantly hit refresh, the view count will go up every time that page loads for even the slightest second. So I'm wondering if it's possible to make it so that the query only submits after the user has been on the page for a certain amount of time (5 seconds). Thanks

Posted
Use the sleep function?

How would i use that function to stop a query from submitting after 5 seconds?

... its probably easy but I've just started php again and i have almost forgot everything.

Posted
/*
- code before query
*/
sleep(5);
/*
- do query
- rest of code
*/

Thanks i've just tried it but it's not the solution i'm looking for. That just makes the page take 5 seconds longer to load

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.   Paste as plain text instead

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