Counter/Accumulator
Moderator: General Moderators
Counter/Accumulator
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?
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
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.
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
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