title: PHP password email taken and password confirm form error message print
body: <p>I have an issue when it comes to email being used twice. It does not print to notify the user that he already has that email used. I had it working before however after adding password confirmation field it stop working. What I want it to do is print "Email is invalid or already taken." when the email is registered again.</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>if ($count==0) {
     if ($_POST["password"] == $_POST["confirm_password"]) {
        $query = "INSERT INTO login(username,email,password) VALUES('$username','$email','$encrypt')";
        if ($dbConnect-&gt;query($query)) {
         $alert = "&lt;div class='alert alert-success'&gt;
            &lt;span class='glyphicon glyphicon-info-sign'&gt;&lt;/span&gt; &amp;nbsp; Registered successfully!
           &lt;/div&gt;";
        }else {
         $alert = "&lt;div class='alert alert-danger'&gt;
            &lt;span class='glyphicon glyphicon-info-sign'&gt;&lt;/span&gt; &amp;nbsp; Error try again or contact web master!
           &lt;/div&gt;";
        }
  
       } else {
  
  
        $alert = "&lt;div class='alert alert-danger'&gt;
           &lt;span class='glyphicon glyphicon-info-sign'&gt;&lt;/span&gt; &amp;nbsp; Email is invalid or already taken.&lt;/div&gt;";
  
       }
  
     }</code></pre>
  </div>
  </div>
  </p>