if ( $num != 0 ) { $auth = true; while($row=mysql_fetch_array($result)){ $userid=$row['userid']; $username=$row['username']; } }