RE: [PHP] Counter
| From: | Mark Douglas | Date: | Thu, 08 May 2003 13:23:44 +0000 |
| Subject: | RE: [PHP] Counter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146838@lists.php.net to get a copy of this message | ||
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