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] Link to comment https://forums.phpfreaks.com/topic/78784-print/ 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()); Link to comment https://forums.phpfreaks.com/topic/78784-print/#findComment-398695 Share on other sites More sharing options...
grlayouts Posted November 26, 2007 Author Share Posted November 26, 2007 didnt print anything.. any1? Link to comment https://forums.phpfreaks.com/topic/78784-print/#findComment-399769 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'"; Link to comment https://forums.phpfreaks.com/topic/78784-print/#findComment-399771 Share on other sites More sharing options...
revraz Posted November 26, 2007 Share Posted November 26, 2007 Cant he just do function price (&$q) ? Link to comment https://forums.phpfreaks.com/topic/78784-print/#findComment-399801 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. Link to comment https://forums.phpfreaks.com/topic/78784-print/#findComment-399822 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.