Afterthought -- you could make this self-maintaining by doing a select for 
$PHP_SELF and inserting the record if mysql_num_rows() returned 0. Downside 
is that it would add greatly to the overhead.


At 04:42 PM 1/16/2002 -0400, Miles Thompson wrote:
>Before leaping to the wrong conclusion, what exactly do you want to count? 
>You can derive the number of times a page has been fetched from your web logs.
>Alternately, you could add a  table to your database, and at the top of 
>the page the link points to, after you've established your database 
>connection, etc.:
>$sql_count = "update page_count set views = views + 1 where page = 
>'$PHP_SELF' ";
>mysql_query( $sql_count );
>You'll have to add a record for each page to the database, and by now you 
>know how to create tables etc. Justwatch out for reserved words and 
>function names; when I first typed the query I used "count" in place of 
>page_count. "Views" and "page" probably aren't such a hot choices either.
>Fetching the counts for the pages involves nothing more than issuing 
>"select * from page_count" and you'll have a per page count of all the 
>clicks to each page.
>At 08:07 AM 1/17/2002 +1300, Barry Rumsey wrote:
>>How do you add a count feature to a link. I can get stuff from the db but 
>>want to know how many times it's been read or click on?
>PHP Database Mailing List (
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to