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()); ?> Link to comment https://forums.phpfreaks.com/topic/78713-requires/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.