RE: [PHP] Counter
| From: | Jennifer Goodie | Date: | Fri, 09 May 2003 02:21:42 +0000 |
| Subject: | RE: [PHP] Counter | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146961@lists.php.net to get a copy of this message | ||
If it is not a real counter and truly needs to just be a number that
increments once every 12 seconds from a given start point you could just do
something like this
<?php
DEFINE ('START_TIME', '1052446787');
$now = time();
$hits = floor(($now - START_TIME)/12);
echo $hits;
?>
No specific reason for using the define except that the number is a
constant. You could just use a variable if you wanted. I think I'm getting
a little loopy from staring at a monitor all day.
> -----Original Message-----
> From: John Hicks [mailto:frappyjohn@gulfbridge.net]
> Sent: Thursday, May 08, 2003 7:11 PM
> To: Shaun; php-general@lists.php.net
> Subject: Re: [PHP] Counter
>
>
> Shaun--
>
> 7000 per day is about once every 12 seconds.
>
> You should be able to use PHP to calculate a starting number for
> a page based on the current timestamp.
>
> Then use Javascript on the page to increment the count once every
> twelve seconds.
>
> --John
>
>
> On Thursday 08 May 2003 09:12 am, Shaun wrote:
> > Hi,
> >
> > I have a client who wants a counter on their site showing
> > a number which rises by 7000 a day and visibly clocks up
> > whilst a user is on the site. This is meant to show the
> > number of products they sell a a day. I'm just not sure
> > how this would work though, would i have to store the
> > ammount in a database, how would it increment whilst no
> > one is one the site.
> >
> > Thanks for your help