Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7060681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:22:55+00:00 2026-05-28T04:22:55+00:00

I want to add unique hit counter to my website using PHP. So this

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:22:55+00:00Added an answer on May 28, 2026 at 4:22 am

    This schema is sufficient (although using Redis or another memory-based data store will be much faster if you can add it to your architecture).

    Use PHP’s ip2long (before you store the IP address) and long2ip (when you retrieve the IP address) to store IP addresses in base 32 and retrieve them as IP address strings – this allows much faster retrieval (integers are faster in query clauses, groups etc than strings).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add a unique hit counter to my website using PHP. This
I want to add only unique records into a database table. Is there any
I want add my page some div and another tags.I wanna give unique class
I want to add unique ID (within a single session) to each object of
I am unsure how to go about this, I want to add unique identifiers
I want add a unique class for each new div after input, how is
I have a website built with ASP.NET (3.5) and want add some level of
I want to add a column to an existing legacy database and write a
I want to add a mailto link on our web page. I want to
I want add user in ActiveDirectory. I use this code private SPUser CreateUser(string strLoginName,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.