Phpfr3ak Posted February 10, 2012 Share Posted February 10, 2012 Sorry maybe the wrong section, looking for a tutorial or something along those lines if anybody knows where i can find one, just to loop until a certain value is met from a column, any help would be great cheers. Quote Link to comment https://forums.phpfreaks.com/topic/256854-how-to-loop-until-a-certain-value-is-met/ Share on other sites More sharing options...
kicken Posted February 10, 2012 Share Posted February 10, 2012 Do you mean you want a script that just sits there and waits until a particular db column gets changed? Essentially you'd just make a while(true) loop and inside it query that column and when it changes do something. Not very efficient though. Perhaps you could explain your situation / goal? Quote Link to comment https://forums.phpfreaks.com/topic/256854-how-to-loop-until-a-certain-value-is-met/#findComment-1316843 Share on other sites More sharing options...
Phpfr3ak Posted February 10, 2012 Author Share Posted February 10, 2012 Sorry basically its something along the lines of, Player A buys x amount from player B, the cron runs every :10 on the hour, and essentially sells that resource, resourses have different values, for example at :10 player A sells 100 resourses, 50 of those resources would be in 1 row, and 50 in another, if that makes sense it can vary, hope that explains it somewhat better? Quote Link to comment https://forums.phpfreaks.com/topic/256854-how-to-loop-until-a-certain-value-is-met/#findComment-1316845 Share on other sites More sharing options...
trq Posted February 11, 2012 Share Posted February 11, 2012 hope that explains it somewhat better? Nope. Quote Link to comment https://forums.phpfreaks.com/topic/256854-how-to-loop-until-a-certain-value-is-met/#findComment-1316920 Share on other sites More sharing options...
livethedead Posted February 11, 2012 Share Posted February 11, 2012 I'm not sure if this is what you were asking for, but I think it will point you in the right direction at least. I am also incredibly new to PHP so I doubt this code is optimal. <?php $query = // the query you want to execute once said number is met $check_query =; // query used to check current number $resource_number = mysql_query($check_query); $resource_goal_number =; //number to execute query on $resource_execute = mysql_query($query); while $resource_number < $resource_goal_number { $execute = false; if ($execute) { mysql_query($query); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/256854-how-to-loop-until-a-certain-value-is-met/#findComment-1316928 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.