Pi_Mastuh Posted August 26, 2006 Share Posted August 26, 2006 I need a script that tells it if the number is greater then 1 then to decrease by 1 every 24 hours. How would I code that? I'm guessing something like<? if $hunger <1 then -1 ?> but i have no idea if thats right. And it also doesn't tell it do it every 24 hours...??? Quote Link to comment https://forums.phpfreaks.com/topic/18756-how-do-i-make-a-script-that/ Share on other sites More sharing options...
wildteen88 Posted August 26, 2006 Share Posted August 26, 2006 use [code=php:0]if($hanger > 1){ // decrease by 1 $hanger--;}[/code]Now to run it every 24 hours you'll want to setup a cron tab (unix servers) or Schedule (Windows) Quote Link to comment https://forums.phpfreaks.com/topic/18756-how-do-i-make-a-script-that/#findComment-80898 Share on other sites More sharing options...
Pi_Mastuh Posted August 26, 2006 Author Share Posted August 26, 2006 Ok. How do I set up a schedule? Quote Link to comment https://forums.phpfreaks.com/topic/18756-how-do-i-make-a-script-that/#findComment-80903 Share on other sites More sharing options...
AndyB Posted August 26, 2006 Share Posted August 26, 2006 [quote]Ok. How do I set up a schedule?[/quote]Google, perhaps?http://www.visualcron.com/ Quote Link to comment https://forums.phpfreaks.com/topic/18756-how-do-i-make-a-script-that/#findComment-80910 Share on other sites More sharing options...
Pi_Mastuh Posted August 26, 2006 Author Share Posted August 26, 2006 There isn't just some script I can put in that tells it do it every 24 hours? Quote Link to comment https://forums.phpfreaks.com/topic/18756-how-do-i-make-a-script-that/#findComment-80911 Share on other sites More sharing options...
wildteen88 Posted August 26, 2006 Share Posted August 26, 2006 No. PHP runs on a per request basis. Meaning PHP will run when a request to a PHP file is made. A schedule is the only option to run a PHP script at a specific time. Quote Link to comment https://forums.phpfreaks.com/topic/18756-how-do-i-make-a-script-that/#findComment-80914 Share on other sites More sharing options...
Pi_Mastuh Posted August 26, 2006 Author Share Posted August 26, 2006 Ok Quote Link to comment https://forums.phpfreaks.com/topic/18756-how-do-i-make-a-script-that/#findComment-80917 Share on other sites More sharing options...
Pi_Mastuh Posted August 26, 2006 Author Share Posted August 26, 2006 Also, how do I make a list box that drops down with all the items in a database row belonging to that user, and then it increases the number in a field for the item they selected. I know that to increase it would be $hunger++ but how do I do the list box thing? Quote Link to comment https://forums.phpfreaks.com/topic/18756-how-do-i-make-a-script-that/#findComment-80918 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.