Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 26th, 2004, 07:59 AM
Authorized User
 
Join Date: Dec 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cutesneakers Send a message via Yahoo to cutesneakers
Default Reads : Hit counter

hi,

  I have the following doubt:
 I have a list of reviews. Now if i want to know how many times a particular review has been read,Do i have to implement it using sessions? OR how do i maintain a read hit counter for each review?
 I am not really concerned about accurate hit counts.
 Any non-session based simple,hit counter code will do.

Thanks.
__________________
site lead ,apartment27 studios.
 
Old December 28th, 2004, 11:44 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I'd put the hit counter in a flat file or DB table.

If your list of reviews is DB-driven, the latter would be best.

You'd do that something like the following.
UPDATE `sql_table` SET `counter_field` = `counter_field` + 1 WHERE `some_condition` = true;

Session-based counters only last for the session and are only representative of that user, not all users. I assume you want something more persistent and representative of all users.

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design





Similar Threads
Thread Thread Starter Forum Replies Last Post
A Hit Counter, PLEASE HELP !!!!! ARD_40 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 April 23rd, 2006 06:25 AM
Hit Counter Help! NeilS21 Classic ASP Databases 4 April 29th, 2005 06:59 AM
hit counter gumgak Classic ASP Basics 2 November 2nd, 2003 12:44 AM
Hit Counter mateenmohd HTML Code Clinic 7 September 28th, 2003 07:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.