Page 1 of 1

Storing visitor hits in mysql

Posted: Tue Apr 21, 2009 6:16 pm
by tomsace
Hey,

I have started my own games website. I store each game information in a mysql database. Also each game has its own unique ID. How can I store the hits for each unique visitor for each game in each of the games information in the database?

For example this would be my database:

Image

Thanks.

Re: Storing visitor hits in mysql

Posted: Thu Apr 23, 2009 10:30 am
by philln
You could store each visitors IP address($_SERVER['REMOTE_ADDR']) in your database and then for every unique address increase your hit counter.

If you have high levels of traffic an easier option would be to create a cookie when each user visits your pages - if a cookie doesn't exist they are a new user!

Then update your hit counter accordingly.