Dogboys Posted May 21, 2006 Share Posted May 21, 2006 How would i make it so everyones mana recharged?So like `$mana` is the stat that i want to reset to full for everyone at the begginging of each day.Thank you for your time. Quote Link to comment https://forums.phpfreaks.com/topic/10104-need-some-help/ Share on other sites More sharing options...
jeremywesselman Posted May 21, 2006 Share Posted May 21, 2006 You need to set up a Cron Job to run every night at a certain time to reset the stat.I don't have any experience, but you can always google it.[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--] Quote Link to comment https://forums.phpfreaks.com/topic/10104-need-some-help/#findComment-37609 Share on other sites More sharing options...
.josh Posted May 21, 2006 Share Posted May 21, 2006 please take the time to post a more specific question. you are only doing yourself a dis-service, as nobody can help you if they don't know the details. for instance, i can assume that you have a column called mana in a mysql database, and i can assume that the value for fully recharged mana is 100. so the query string would look like this:update tablename set mana=100and i can assume that you know enough php to be able to connect to your database and run that query, and i can assume that if i told you to make a cron job and set it for every 24 hours, you'd know what i was talking about. but that's a lot of assumptions and this could very easily have been a complete waste of time posting this help, as none of it could apply to you. is it really that hard to be more specific? i'm sorry. i'm tired. been up for almost 48 hours. but it's true, nonetheless. that just happens to be one of my pet peeves. Quote Link to comment https://forums.phpfreaks.com/topic/10104-need-some-help/#findComment-37620 Share on other sites More sharing options...
Barand Posted May 21, 2006 Share Posted May 21, 2006 An alternative to a cron job is to store the date that the mana was last recharged.if that date is not today's date, recharge the mana to 100. Set the date recharged to today. Quote Link to comment https://forums.phpfreaks.com/topic/10104-need-some-help/#findComment-37626 Share on other sites More sharing options...
.josh Posted May 21, 2006 Share Posted May 21, 2006 re: barand's alternative: A person's mana will not actually recharge until they access the script that does that. So you could have some people who access that script everyday, and other people who only login once a week. They will be recharged just the same, but at different, user dependent times. You may or may not need to consider that in how you want your code to behave. Quote Link to comment https://forums.phpfreaks.com/topic/10104-need-some-help/#findComment-37630 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.