grlayouts Posted June 15, 2008 Share Posted June 15, 2008 i have a query that wont add.. $pr = mysql_fetch_array(mysql_query("SELECT boost FROM boosts;")); function price ($q) { if ($q > 1000000) return 25; return ceil($q * -275 / 1000000 + 750) +$pr[boost]; everything a part from the last bit +$pr[boost]; adds together. when i print $pr[boosts] i get the correct 50. but it wont add. any idea's? Link to comment https://forums.phpfreaks.com/topic/110320-solved-wont-update/ Share on other sites More sharing options...
maexus Posted June 15, 2008 Share Posted June 15, 2008 One thing I noticed right away, $pr[boost]; should be $pr['boost']; and it wouldn't hurt to have back ticks for your field and tables names in your query Link to comment https://forums.phpfreaks.com/topic/110320-solved-wont-update/#findComment-566014 Share on other sites More sharing options...
cooldude832 Posted June 15, 2008 Share Posted June 15, 2008 well your function never defines $pr and if its in the global scope well then you can't get to it so directly in your function. Link to comment https://forums.phpfreaks.com/topic/110320-solved-wont-update/#findComment-566016 Share on other sites More sharing options...
grlayouts Posted June 15, 2008 Author Share Posted June 15, 2008 never mind im an idiot global $pr; because its outside.. thanks guys. Link to comment https://forums.phpfreaks.com/topic/110320-solved-wont-update/#findComment-566020 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.