pmonty Posted January 27, 2013 Share Posted January 27, 2013 My statement mysql_query("UPDATE videos SET views = views + 1 WHERE code = '$video'"); it seems to be updating the view count by 1 but the moment that i go to another video then another it starts to increase by 1 or more every time during that session. I am killing the mysql connection to so not sure whats its doing. Any idea guys? Link to comment Share on other sites More sharing options...
pmonty Posted January 28, 2013 Author Share Posted January 28, 2013 best way i am thinking of is to get the result and then work out what it needs to b then just have SET 'whatever the number is' instead Link to comment Share on other sites More sharing options...
thescientist Posted January 29, 2013 Share Posted January 29, 2013 what logic/code do you have in place to make sure it _doesn't_ update more than once per session? Link to comment Share on other sites More sharing options...
MrFish Posted January 29, 2013 Share Posted January 29, 2013 Try getting the session id. session_id();Add it to an active viewers table with the video code viewed and the session id used to view that video.If you find a match then it was viewed by that user.Clear this once a day or it will stack up. There may be a more elegant solution. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now