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? Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. 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.