pietbez Posted July 19, 2013 Share Posted July 19, 2013 can someone please point out where i m going wrong. this code is working fine, but i need the results in a variable $result = mysql_query("SELECT * FROM `gifts` WHERE `id` =$id "); while($row = mysql_fetch_array($result)) { echo $row['price'] , $row['units']; } so, when i do this, i only get the first variable??? $result = mysql_query("SELECT * FROM `gifts` WHERE `id` =$id "); while($row = mysql_fetch_array($result)) $price = $row['price']; $units = $row['units']; { echo $price , $units; } please help. Quote Link to comment https://forums.phpfreaks.com/topic/280297-store-result-in-variable/ Share on other sites More sharing options...
Solution litebearer Posted July 19, 2013 Solution Share Posted July 19, 2013 (edited) look at the placement of your braces also variable DOT variable, NOT comma Edited July 19, 2013 by litebearer Quote Link to comment https://forums.phpfreaks.com/topic/280297-store-result-in-variable/#findComment-1441319 Share on other sites More sharing options...
mac_gyver Posted July 19, 2013 Share Posted July 19, 2013 echo actually does accept a comma separated list of arguments. Quote Link to comment https://forums.phpfreaks.com/topic/280297-store-result-in-variable/#findComment-1441320 Share on other sites More sharing options...
pietbez Posted July 19, 2013 Author Share Posted July 19, 2013 thanks, got it Quote Link to comment https://forums.phpfreaks.com/topic/280297-store-result-in-variable/#findComment-1441321 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.