ninnypants
03-09-2009, 07:13 PM
Is there a way to use one variables value as a variable name without code like
if($row['user_name'] == 'Jim'){
$jim = $row['user_id'];
}
if($row['user_name'] == 'ninnypants'){
$ninnypants = $row['user_id'];
}
This is all well and good since I would know what the usernames I'm pulling out are, but is there a way to automate this so that I wouldn't have to write so many if statements?
if($row['user_name'] == 'Jim'){
$jim = $row['user_id'];
}
if($row['user_name'] == 'ninnypants'){
$ninnypants = $row['user_id'];
}
This is all well and good since I would know what the usernames I'm pulling out are, but is there a way to automate this so that I wouldn't have to write so many if statements?