Re: php-counter
| From: | Sheridan Saint-Michel | Date: | Wed, 22 Aug 2001 16:10:28 +0000 |
| Subject: | Re: php-counter | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63923@lists.php.net to get a copy of this message | ||
No, but I could throw one together in 10 minutes.
Here is some 5 minute untested code to get you started
where int count is in table counter.
<?php
$dblink = mysql_pconnect("localhost","username","password");
mysql_select_db("DB");
?>
<!-- HTML PAGE -->
<?php
$query = "Select count from counter";
if( !($dbq = mysql_query($query,$dblink)))
{
echo "Error reading database. Please Contact <A
HREF=\"mailto:webmaster@yoursite.com\">Administrator</A>";
exit;
}
$count = mysql_result($dbq,0)
echo "This page has been visited $count times!";
$query = "Update counter set count = count + 1";
if( !($dbq = mysql_query($query,$dblink)))
{
echo "Error updating database. Please Contact <A
HREF=\"mailto:webmaster@yoursite.com\">Administrator</A>";
exit;
}
?>
Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com
----- Original Message -----
From: "Gert Mellak" <gert.mellak@utanet.at>
To: <php-general@lists.php.net>
Sent: Wednesday, August 22, 2001 10:49 AM
Subject: [PHP] php-counter
> hi!
>
> do you know an easy-to-use-php-counter, which uses mysql to store the
data?
>
> gert
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net