Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to record Number of Views

Status
Not open for further replies.

uticket

IS-IT--Management
Jun 1, 2004
37
US
Hi,

I am developing a web site using PHP on Apache server, which supports FrontPage Extension.

I want to display on the web page how many times this page has been viewed.

How can I do that? Is there any file attrbute that tell you the number of access this file has?

Or do I have to use database to record the number?

Thanks for all your helps?

 
As far as I know, you'd have to create either a table in a database that will be updated every time the php script is called, or you'd need to create a text file that can be updated every time the php script is called.

There needs to be some way for you to store the number of hits.

*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
Every request for a page is recorded in the web server logs. FOr statistical purposes those logs can be used with a reporting mechanism. For a on-the-fly counter it is not a viable option, as the processing of large log files is not what you want upon each visit.
A counter that adds to a number in a text file seems the easiest way to do that. The database has advantages when it comes to tracking more than just a couple of pages.
Also, remember, hit means every request: reloads, partial content (if chunked transfer), spiders and bots.
 
Thanks a lot!!!

Is there any smaple code for doing this: record the number of access.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top