# \[help\] WHILE loop not working?

**URL:** <https://forum.kirupa.com/t/help-while-loop-not-working/266204>\
**Category:** Uncategorized\
**Created:** [July 17, 2008, 6:53am UTC](https://forum.kirupa.com/t/help-while-loop-not-working/266204 "2008-07-17T06:53:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjj](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@cjj](https://forum.kirupa.com/u/cjj)\
**Post date:** [July 17, 2008, 6:53am UTC](https://forum.kirupa.com/t/help-while-loop-not-working/266204/1 "2008-07-17T06:53:28Z")

</div>

I’m trying to run a while loop so I can determine if one of the (many) email addresses inside my “table\_1” match any of the email addresses inside my “table\_2”.

But it won’t work!!

I must be doing something wrong or maybe I shouldn’t even be using a WHILE loop. Can someone help me with this. I would be so happy and grateful!! 😃 😃

```php
while($row2 = mysql_fetch_array($get_names2_res)) { 
while($row = mysql_fetch_array($get_names_res)) { 

  $friend_email = stripslashes($row['friend_email']);
  $users_email = stripslashes($row2['email']);
  
  if ($users_email == $friend_email) {
  
  echo"Yeah we found that name ($users_email)";
       
  }
}

}

```

It works but not how I want it to work. It only reads one email at a time and I need it to read all the emails at one time.
