What’s the best way to print from MySQL using PHP when you know there’s only going to be a single record?
My SQL statement is:
select user from users where user = 'norman';
This will return only a single record. So what’s the best way to print it? I currently do:
while ($info=mysql_fetch_assoc($data))
etc
But that’s OK for more than one record. Any better way to do this when there’s only one?
If you’re absolutely certain that this query will always retrieve 1 row then this should be enough:
Then you can manipulate $row (the single row) at your will.