so i have a data set that i would like to extract from a database and then create php variables that correspond to the fields from the database (like $field=$value).
here is my code:
$sql="SELECT * FROM $table WHERE id='$id'";
$qry=mysql_query($sql)or die(mysql_error());
while($result=mysql_fetch_array($qry, MYSQL_ASSOC)){
foreach($result as $key=>$value){
$str=$key." = '".$value."';";
eval($str);
}
}
but when i run it i get an "unexepected '=' in eval'd code on line..."
what gives? i really want to get my arms around eval, and i cant seem to.. otherwise i would just use another method