title: PHP mySQL if statement - check if email already in db
body: <p>I have a form to register e-mails on my site. I am trying to create a check in PHP to first determine if the e-mail has already been registered in the DB before allowing the user to register it again.</p>
  
  <p>The IF statement is not executing.... what have I done wrong? The else statement works fine.</p>
  
  <p>Please note - the db.php file includes the connection settings $conn. The else statement is putting the e-mail addresses into the db.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;?php
  
  include_once 'db.php';
  
  $fullname = $_POST['signup_name_of_user'];
  $email = $_POST['signup_email_of_user'];
  
  
  mysqli_select_db('database');
  
  if(isset($_POST['signup_email_of_user']))
  {
    $checkdata = "SELECT signup_email_of_user FROM database WHERE signup_email_of_user = '$email'";
    $query = mysqli_query($conn, $checkdata);
    if(mysqli_num_rows($query&gt;0))
    {
      echo "E-mail Already Exists. You cannot register more than twice!";
      exit();
        }
  
    else {
      $sql = "INSERT INTO database (signup_name_of_user, signup_email_of_user) VALUES ('$fullname', '$email')";
  
      mysqli_query($conn, $sql);
  
      echo "You have been successfully registered";
  
  
    }
  }
  
   ?&gt;</code></pre>
  </div>
  </div>
  </p>