RE: [PHP] Counter
| From: | Mark Douglas | Date: | Thu, 08 May 2003 13:36:42 +0000 |
| Subject: | RE: [PHP] Counter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146841@lists.php.net to get a copy of this message | ||
If they want to see the counter incrementing while the user is sitting on
one page, you're going to have to do something in javascript or another
dynamic language. As is stated many times on this list, PHP is server side
only and will not make a webpage dynamic at the client side for you.
-----Original Message-----
From: Shaun [mailto:shaun@mania.plus.com]
Sent: Thursday, May 08, 2003 9:31 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Counter
Thanks for your reply mark,
but they want to see the counter actually incrementing whilst the user is on
the site...
"Mark Douglas" <Mark.Douglas@Q9.com> wrote in message
news:05924A4A9DEDAD46A21EE3C8C64B090D02B6CDC6@cheetah.zoo.q9networks.com...
> I'm not awake enough to provide example code, but something like this
should
> work:
>
> - Set a base date
> - Set a base counter value
> - Get the current date, subtract base date, gives you number of days since
> start of counter
> - multiple number of days since start of counter by 7000
> - add this value to base counter value, giving you start of day value
> - divide 86400 by 7000 to give number of seconds that needs to pass to
> increment value
> - count number of seconds that has passed in the day, divide by number of
> seconds to increment, giving todays current addition to counter
> - add current addition to start of day value
>
> Voila, you have a piece of code that you can put in a header/footer on
every
> page and will be different every time a user loads a page. This is
asssuming
> you're just going on the 7000/day value, and not actually caring about the
> real number of units sold.
>
> I hope that didn't confuse too much.
>
> Mark
>
> -----Original Message-----
> From: Shaun [mailto:shaun@mania.plus.com]
> Sent: Thursday, May 08, 2003 9:13 AM
> To: php-general@lists.php.net
> Subject: [PHP] Counter
>
>
> 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
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php