grlayouts Posted November 25, 2007 Share Posted November 25, 2007 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] Quote Link to comment Share on other sites More sharing options...
xyn Posted November 25, 2007 Share Posted November 25, 2007 I noticed your mysql syntaxs aren't correct. use or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
grlayouts Posted November 26, 2007 Author Share Posted November 26, 2007 didnt print anything.. any1? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 26, 2007 Share Posted November 26, 2007 didnt print anything.. any1? Replace $q with a actually string or number, then use mysql_error()); to see your problem in the query. Aslo: change $sql = "UPDATE price SET cost = $q where ITEM = 'drugs'"; To $sql = "UPDATE price SET cost = '$q' where ITEM = 'drugs'"; Quote Link to comment Share on other sites More sharing options...
revraz Posted November 26, 2007 Share Posted November 26, 2007 Cant he just do function price (&$q) ? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 26, 2007 Share Posted November 26, 2007 Cant he just do function price (&$q) ? I was correcting his SQL, and he can also do a function that he can just change the value everytime. 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.