Posted by newbie on 08/02/07 05:51
table `user`
---------------------------------------
| id | user_name | gender |
---------------------------------------
I can gurantee that ids in table user are unique (so each number
correspond at most one row in the table). I have two questions
1) can I somehow do away with mysql_fetch_array($result);?
2) If i use $sql_query = "SELECT user_name from `user` WHERE (id =
'$id')"; to replace line (1), do I get some better performance
theoretically? if so, can I simply return $row; ---because
'user_name' is the only field being selected.
$sql_query = "SELECT * from `user` WHERE (id = '$id')"; // (1)
$result = mysql_query($sql_query);
$row = mysql_fetch_array($result);
return $row['user_name'];
Thanks,
Navigation:
[Reply to this message]
|