mattm1712 Posted October 17, 2012 Share Posted October 17, 2012 i am trying to do this <?php $priceformat = "decimal"; $query = mysql_query("SELECT * FROM price"); $array = mysql_fetch_assoc($query); echo $array[$priceformat]; ?> so i want to return the decimal price from my database cheers matt Quote Link to comment https://forums.phpfreaks.com/topic/269590-variable-in-an-array-help/ Share on other sites More sharing options...
ManiacDan Posted October 17, 2012 Share Posted October 17, 2012 Is the field named "decimal"? Quote Link to comment https://forums.phpfreaks.com/topic/269590-variable-in-an-array-help/#findComment-1385817 Share on other sites More sharing options...
mattm1712 Posted October 17, 2012 Author Share Posted October 17, 2012 yeah if i put decimal into where $priceformat is it works but i want to be able to change so i can another format out Quote Link to comment https://forums.phpfreaks.com/topic/269590-variable-in-an-array-help/#findComment-1385824 Share on other sites More sharing options...
Jessica Posted October 17, 2012 Share Posted October 17, 2012 Your response doesn't make any sense. What columns does your table have? What is your end goal? What should the output LOOK like? Are you saying to want to format the price, or get a specific column? Quote Link to comment https://forums.phpfreaks.com/topic/269590-variable-in-an-array-help/#findComment-1385825 Share on other sites More sharing options...
ManiacDan Posted October 17, 2012 Share Posted October 17, 2012 Yeah, we need more information. Before/after, some examples, something. Quote Link to comment https://forums.phpfreaks.com/topic/269590-variable-in-an-array-help/#findComment-1385845 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.