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. Link to comment https://forums.phpfreaks.com/topic/109257-solved-output-to-create-variables/ 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. Link to comment https://forums.phpfreaks.com/topic/109257-solved-output-to-create-variables/#findComment-560423 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. Link to comment https://forums.phpfreaks.com/topic/109257-solved-output-to-create-variables/#findComment-560435 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.