Jump to content

grlayouts

Members
  • Posts

    342
  • Joined

  • Last visited

Everything posted by grlayouts

  1. ok the end price[boost] wont add on but will print. $price = mysql_fetch_array(mysql_query("SELECT * FROM boosts;")); return ceil($q * -275 / 1000000 + 750) + $price["boost"];
  2. echo "$q :" . price($q) . '<br>'; how would i put price($q) into the database i get the read out as a number mine is $sql = "UPDATE price SET cost = price($q) where ITEM = 'drugs'"; mysql_query($sql) or die($sql . ' : ' . mysql_error()); doesnt work.
  3. ok last script didn't work so im gonna start from scratch and make it simple. i have the code to get the ammount of my product $q = mysql_fetch_row(mysql_query("SELECT SUM(drugs) FROM players;")); not to spam but there's a game called freemarkets. www.sepica.com and the consumer market is the best example i can give. i want that sort of idea. if anyone wants to sign up and give me an idea.
  4. cant get what i want gonna start again
  5. $q2 = mysql_fetch_row(mysql_query("SELECT SUM(drugs) FROM players;")); // GET THE AMMOUNT OF DRUGS function price ($q) { if ($q > 1000000) return 25; return ceil($q * -275 / 1000000) + 300; // if there more than 1000000 drugs do equasion. to get the price. } what i want instead of a price equasion is a percentage. ie $maxprice=200 equasion result = 15% so i would get 15% of 200 does that make sense?
  6. too simple for what i will be adding later. can i set the value as a percentage. ie if 10000 drugs price is 20% of 200. if 20000 drugs price is 30% of 300.
  7. its for rounding to a whole number. I wrote it. ok.. $q2 takes the sum of the product which is drugs at the moment. if there is over 100000 then it works out a price for selling the product. what i want to do is when the price is worked out for the product i want to limit it between 1-200 just now im getting huge results and the ammount of the product sum is huge. hows that?
  8. i dont want someone to write it for me. i want to know how to range the ceil from 1-200
  9. ok simply.. i want the ceil to range between 1-200. { if ($q > 1000000) return 25; return ceil($q * -275 / 1000000) + 300; } $qtys = $q2; foreach ($qtys as $q) { echo "$q :" . price($q) . '<br>';
  10. I have a market game that depending on the ammount of product on the market depends on the price. but here's the thing what i want it to do 1. it keep the price of the drugs between 100-200 2. if someone sells another product for example steaks it boosts the price for everything. the code works but i dont know how to acheive what i want <? 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*2), dpayout = (drugfact*2);'); 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()); ?>
  11. I have a market game that depending on the ammount of product on the market depends on the price. but here's the thing what i want it to do 1. it keep the price of the drugs between 100-200 2. if someone sells another product for example steaks it boosts the price for everything. the code works but i dont know how to acheive what i want. <? 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*2), dpayout = (drugfact*2);'); 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()); ?>
  12. now im getting Parse error: syntax error, unexpected T_LNUMBER in
  13. i want to insert into database but im getting error "Parse error: syntax error, unexpected T_STRING" my code is. mysql_query("insert into players (user, email, pass, ip, code, level, strength, agility) values('"HoboManOne"', '"test@test.test"', '"0"', '"0.0.0.0"', '"0"', '"1"', '"100"', '"100"')") or die("Could not register.");
  14. didnt print anything.. any1?
  15. any idea why $sql = "UPDATE price SET cost = $q where ITEM = 'drugs'"; even print"$q"; doesnt show the price. 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*2), dpayout = (drugfact*2);'); mysql_query('UPDATE players SET credits = credits - (employees*wages)'); $sql = "UPDATE price SET cost = $q where ITEM = 'drugs'"; [code] [/code]
  16. 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()); ?>
  17. now if i have 4000 of (product) at price 240 and 3999 are sold instead of it going back up to the max at 300 return maybe 290
  18. Barand i can't thank you enough mate.. thanks for the help i ended up with <? include('config.php'); $q2 = mysql_fetch_row(mysql_query("SELECT SUM(drugs) FROM players;")); function price ($q) { return ceil($q * -275 / 20000) + 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()); ?> works a treat!!
  19. do i have to set $q? as my product ammount? $q = mysql_fetch_row(mysql_query("SELECT SUM(product) FROM players;"));
  20. barand thats exactly what i was looking for. will it work if the quantitys are 333? or 659?
  21. well i've had a few( one posted yesterday) i was thinking an algorithm but i never wrote one.
  22. say i have a record that changes from 1 - 10000 and i want it to create a price between 25-300 depending on how many there are. ie 5000 price is 300 any idea's?
  23. it was for the echo i had. either way with or without the . is still doesn't work
  24. no the count comes back with a number
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.