Sunday, 15 September 2013

Will this while loop end when the if statement inside is met

Will this while loop end when the if statement inside is met

I have this block of function that searches through my email column for
matches. After a match has been found, will this While loop continue to
search for other matches or will it end if the if statement inside it is
met?
function find_similar_email ($email) {
global $con;
// select db
mysql_select_db('practice', $con);
// select a column to search from
$emailList = mysql_query("SELECT email FROM users", $con);
// search for similar matches
while ($emailListResult = mysql_fetch_array($emailList)) {
if ($email == $emailListResult['email']) {
return TRUE;
}
}
}

No comments:

Post a Comment