title: How to check if user already exists in MySQL with PHP
body: <p>I am using following code which is not working for me.</p>
  
  <pre><code>$con=mysqli_connect("localhost","root","","my_db");
  $check="SELECT COUNT(*) FROM persons WHERE Email = '$_POST[eMailTxt]'";
  if (mysqli_query($con,$check)&gt;=1)
  {
      echo "User Already in Exists&lt;br/&gt;";
  }
  else
  {
      $newUser="INSERT INTO persons(Email,FirstName,LastName,PassWord) values('$_POST[eMailTxt]','$_POST[NameTxt]','$_POST[LnameTxt]','$_POST[passWordTxt]')";
      if (mysqli_query($con,$newUser))
      {
          echo "You are now registered&lt;br/&gt;";
      }
      else
      {
          echo "Error adding user in database&lt;br/&gt;";
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Object of class mysqli_result could not be converted to int in
    <strong>C:\xampp\htdocs\Exp\welcome.php</strong></p>
  </blockquote>