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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php page displays all my pages...how can I still track stats?

Status
Not open for further replies.

RZillmer

Programmer
Nov 20, 2001
42
US
I use the page showarticle.php to display all the articles I have stored in my database. I pick the article by linking to showarticle.php?articleID=4 or whatever article number it is.

When I check the statistics on my website, it only tells me how many times showarticle.php has been visited. Is there any modifications I can make to see what articles are getting more hits than others?

Thanks in advance for any help.
 
Generally, web stats don't track CGI input variables.

Since you have a database in use anyway, I recommend you add a column to the table which stores your articles to hold a count of the number of times that article has been retrieved.

Then modify your script so that before it retrieves the article, it increments the counter. ______________________________________________________________________
TANSTAAFL!
 
I've had another person suggest to change my links to showarticle/4.spank and insert this bit of code in my showarticle.php

//.spank
if (ereg("^/([0-9]{1,6})",$PATH_INFO,$id)) { $articleID = $id[1]; }

It wouldn't necessarily have to be .spank, but could I get by with having no extension at all? Also, do you see a downside to doing it this way? I really don't like the guy who suggested it and would LOVE to throw something back in his face. Yes, I am that petty.

P.S. Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top