the query you make returns a result that finds all of the emails that might have been input. there is no need for you to loop through your email array -- all you need to do is loop through the result set. also, there is again no need to check if the email is one of the entered emails; you're only returning the entered emails. if no emails are found, then mysql_count() will return 0.

PHP Code:
$query mysql_query($sql);

if(
mysql_count($query) > 0){

 
// loop through result set

}else{

  echo 
'register';