Sunday 15 May 2011

php - Hit counter - do I need a dedicated table? -


I am reading about different ways that I can take to implement the hit counter. I had a session / cookie flag for a specific user that I liked most, to indicate whether he visited a specific page. If the flag is not set, then I'll set it up and increase the page's hits from 1.

I know that the above method is fine, but I also understand that it will always be an alternative solution. But if I use a dedicated table with a unique barrier on the combination of page_id and ip_address, then working with the combination of the session flag should work the most efficiently. But about the site I am working on is about 20000 hits (which is not enough, but my hit is enough to fill the table) in a day, with the IP address as well as MySQL Can be bound to hit?

Besides, is there a better way to capture legal hits than these?

I think this is too much work for a dedicated table for it only if you really Must be in Otherwise it is a waste of time and resources. A cookie is okay to disable the increase in the field in the current table, and finally increase on refresh.

No comments:

Post a Comment