I want to add unique hit counter to my website using PHP. So this counter will save visitor's IP for each page in database. I have a idea about database structure like this:
1 table ( hits
) and 2 columns ( ip
, page_url
). So I can get distinc IPs using simple SQL query, but i worry about performance. Is it good way to get unique hits for each page ?
In conclusin, what database structure is better for database based unique hit counter system?
EDIT :
I have 2nd question too. After getting visitor's IP in PHP file, is it better to control if in database not this IP, then add it database or just add all visitors IPs, then get distinc IPs for relevant page for getting unique hit count ?
Thanks in advance.