Page 1 of 1
Counter/Accumulator
Posted: Tue Oct 31, 2006 12:09 am
by dunezone
Ive been searching all night on how to make a counter, not a website counter but a way of having a number gradually add itself. For example the page displays 10, and every 5 seconds it will add 10 more. Can this be done with MySQL and PHP?
Posted: Tue Oct 31, 2006 3:04 am
by CoderGoblin
As I understand the question you have the client download a page and then increment the counter.
Once the page is on the client machine you will need to use javascript or some such to implement a counter.
Posted: Tue Oct 31, 2006 11:06 am
by dunezone
Well, the thing is the counter should always be counting up, even when the user does not have the page open. For example lets say its a small game where you are mining gold over time, and you make 100 gold per hour, then it should count up accordingly, Ive seen this done with some browser games, using PHP and I have no clue what else, maybe a database.
Posted: Tue Oct 31, 2006 1:02 pm
by wyrmmage
so, you're making a game?
Well, yes, the answer lies withing the topic of databases. What you really need to do is make a page that counts up (using javascript, perhaps) and then stores whatever number the counter got to( when the user leaves the page or goes elswhere) in a database field. When the user logs back in, you retrieve the value from that field and do whatever you want with it.
If you need help with programming a game, I have had some experience with that sort of thing
-wyrmmage