scarhand Posted July 7, 2009 Share Posted July 7, 2009 Trying to get fields from a mysql table into variables prefixed with $my So I want the 'username' value to be stored under a variable called $myusername Heres code: while ($row = mysql_fetch_assoc($sql)) { foreach ($row as $f => $v) $my{$f} = $v; } Quote Link to comment Share on other sites More sharing options...
scarhand Posted July 7, 2009 Author Share Posted July 7, 2009 NEvermind, got it: ${"my$f"} = $v; 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.