grlayouts Posted November 24, 2007 Share Posted November 24, 2007 ok i have a game based on markets. the code i have takes the stock level and determains a price. what i want to try to get is if one requirment is not there then the payout does not happen. ie. if <200 plastic (as its 200 plastic per toy) then no payout. so if i have 10 ($stats[toyfactorys]) i would need 20000 plastic. if i dont have it only make however much plastic i have or none. any idea's??? the code i have is <? include('config.php'); $q2 = mysql_fetch_row(mysql_query("SELECT SUM(drugs) FROM players;")); function price ($q) { if ($q > 1000000) return 25; return ceil($q * -275 / 1000000) + 300; } $qtys = $q2; foreach ($qtys as $q) { echo "$q :" . price($q) . '<br>'; } mysql_query('UPDATE players SET drugs = drugs + (drugfact*20), dpayout = (drugfact*20);'); mysql_query('UPDATE players SET credits = credits - (employees*wages)'); $sql = "UPDATE price SET cost = $q where ITEM = 'drugs'"; mysql_query($sql) or die($sql . ' : ' . mysql_error()); ?> Quote Link to comment 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.