0

Hi,

Code below always returns only 1 record therefore i don't need while. How can i get result without while loop?

Thanks

$q="SELECT id FROM login WHERE username='$username'";
$sql=mysql_query($q);

if (@mysql_num_rows($sql)==1) {
while ($arr=mysql_fetch_array($sql)) {
$id=$arr["id"];
}
}
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by nav33n
0
$q="SELECT id FROM login WHERE username='$username'";
$sql=mysql_query($q);
if (@mysql_num_rows($sql)==1) {
$arr=mysql_fetch_array($sql);
$id=$arr["id"];
}

:-/

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.