Ryuujin Posted May 17, 2008 Share Posted May 17, 2008 I am trying to get a $row[] var inside a $row[] var. This may not be possible... Here is my code. $result = mysql_query("SELECT units.name, units.offense, units.defence, units.cost, users.FootSoldier, users.Marine, users.Spy, users.Tank, users.Jet, users.Grenadier, users.Rocketeer, users.Battleship FROM units, users WHERE users.username='$_SESSION[user]' ORDER BY units.offense ASC"); while($row = mysql_fetch_array($result)) { $ammount = 'users.'.$row['name']; echo ' <tr> <th>' .$row['name']. '</th><th>' .$row['offense']. '</th><th>' .$row['defence']. '</th><th>$' .$row['cost']. '</th><th>' .$row['$ammount']. '</th> </tr>'; } Any ideas? I am trying to get $row['$ammount'] to have the $ammount var info inside it. Thanks, -Ryu Link to comment https://forums.phpfreaks.com/topic/106076-row-within-a-row/ Share on other sites More sharing options...
nloding Posted May 17, 2008 Share Posted May 17, 2008 Don't do $row['$ammount'] ... do $row[$ammount]. You aren't parsing the $ammount variable with the single-quotes. Link to comment https://forums.phpfreaks.com/topic/106076-row-within-a-row/#findComment-543683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.