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. Link to comment https://forums.phpfreaks.com/topic/280297-store-result-in-variable/ Share on other sites More sharing options...
litebearer Posted July 19, 2013 Share Posted July 19, 2013 look at the placement of your braces also variable DOT variable, NOT comma 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. 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 Link to comment https://forums.phpfreaks.com/topic/280297-store-result-in-variable/#findComment-1441321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.