title: mysql phpmyadmin User Input COMPARE database
body: <p>hi guys i'm new with php and mysql, i am currently trying to check the user input &amp;username if there's already existing the same username in the database, and same with user input $email.</p>
  
  <p>i have below codes, i tried having a line that echoes and compares user input against fetch rows/ data from database. I was able to verify that it reaches to the point where
  line echo $email."COMPARE".$result2; is both the same, yet it passes the condition $email == $result2 where result2 is email fetch from database. Can you please point me what's wrong? THanks in advance.</p>
  
  <pre><code>$extract= mysql_query("SELECT * FROM users");
  $resultq = mysql_num_rows($extract);
  while($row= mysql_fetch_array($extract))
  {
  
      $result = $row['username'];
      $result2 = $row['email'];
  
      echo $email."COMPARE".$result2;
  
      if($username == $result) 
      {
           echo "&lt;script type=\"text/javascript\"&gt;alert('Username Already Taken')&lt;/script&gt;";
           echo "&lt;meta http-equiv=\"refresh\" content=\"0;url=6signup.html\" /&gt;";
           break;
  
      }
      else if ($email == $result2)
      {
           echo "&lt;script type=\"text/javascript\"&gt;alert('Email Already Registered')&lt;/script&gt;";
           echo "&lt;meta http-equiv=\"refresh\" content=\"0;url=6signup.html\" /&gt;";
           break;
      }
      else
      {
          //continues to execute the loop until no more to fetch
      }
  </code></pre>