On Sat, February 17, 2007 1:53 pm, clive wrote: > Denis L. Menezes wrote: >> Dear friends. >> >> I have a site where I have news headers. I wish to count the clicks >> on the >> news headers so that I can see how many times each of the the news >> has been >> viewed. This way I can show the "most viewed" news. >> >> Can one of you please advise hwo this can be done? >> >> > add to each news item like &clicked=1 and in the page where you > display > the news item, checked if clicked exists, if does write it to a file > or > a db (obviously with the news item id), if your using mysql, the heap > table type is quite useful, you will however need to move the info to > a > more permanent table every x amount of clicks. Do you really only want to count the clicks from your own page? Or, put another way, if somebody posts an external link on slashdot and a news story is getting a zillion views from that, do you want to count those as well? It would seem to me that in your "view" script that displays the story you could simply do something like: update story set views = views + 1 where story_id = $story_id And not even worry about the mucking with AJAX nor tracking it from only your own page. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php