[code]$sqlGetAge = “select Age from users where UserId = ‘123’ limit 1”;
$result = mysql_query($sqlGetAge);
while ($row = mysql_fetch_array($result)){
$age = $row{'Age'};
}[/code]
The code will always return one value…the age of user with the UserId of 123. I’m wondering if there is an easier way to get to that number without having to do the while…loop. mysql_fetch_row doesn’t seem like it would work any better since I’ve only ever seen that in a loop too. Any ideas.
I wish it was as simple as:
[code]$sqlGetAge = “select Age from users where UserId = ‘123’ limit 1”;
$result = mysql_query($sqlGetAge);
$age = $result{'Age'};
}[/code]
Thanks
Jeff