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"];
}
}
$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"];
}

:-/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.