wwfc_barmy_army Posted June 8, 2008 Share Posted June 8, 2008 Hello. I am trying to get values from a database and make them into variables at the moment i have this code: $result = mysql_query("SELECT * FROM type") or die(mysql_error()); while ($qry = mysql_fetch_array($result)) { $name = $qry['name']; $$name = $_GET['$name']; } But it doesn't seem to be creating the variables with the $_GET, any ideas or advice? Thanks. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted June 8, 2008 Share Posted June 8, 2008 Try: $$name = $_GET[$name]; Variables inside single quotes are not parsed. Therefore, your previous line tried to access the element of the $_GET array that had the key $name, rather than that which had a key which was the value of $name. Quote Link to comment Share on other sites More sharing options...
wwfc_barmy_army Posted June 8, 2008 Author Share Posted June 8, 2008 Seems to have worked Thanks mate. 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.