I’m having trouble creating dynamic variables using field names. Basically I got a heap of fields named after Players and I want to grab the field name and make a variable called it while assigning it a value from a post variable which is also the player name.
This is the code I’m using:
$result=mysql_query(“SELECT * FROM playerstats”);
while($fld = mysql_fetch_field($result))
{
if ($fld->name!=‘match_id’ && $fld->name!=‘opponent’ && $fld->name!=‘map’)
{
$fld->name=$_POST[$fld->name];
}
}
ATM if I want to add a new player I have to manually update everything, this way I wouldn’t need to.