rok259 Posted April 22, 2014 Share Posted April 22, 2014 Hello Is it possible to have my database increase an integer overtime? For instance every 1 minute add +1 to int field. Only way I could think of getting the result would be to use a PHP script, but not sure if its possible. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 22, 2014 Share Posted April 22, 2014 The database alone wouldn't do that, you would use a tool like cron to schedule something like a PHP script to run once a minute that would do that. Link to comment Share on other sites More sharing options...
davej Posted April 23, 2014 Share Posted April 23, 2014 ...every 1 minute add +1 to int field. Why? Wouldn't it make more sense to write a before-trigger to fake this? Link to comment Share on other sites More sharing options...
rok259 Posted April 23, 2014 Author Share Posted April 23, 2014 Why? Wouldn't it make more sense to write a before-trigger to fake this? I’m developing an RTS MMO that will require resources to gather when the player is logged out of the game. Best way I could think of achieving this would be to have the database auto update the field. Also thanks for the Cron idea, I will check it out. Link to comment Share on other sites More sharing options...
thescientist Posted April 23, 2014 Share Posted April 23, 2014 or you could just track the time which the user left, and then figure out how much time has passed at his next login, and then update the column that way. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now