Creating a condition to prove data already exists in a database using an if statement
<p>In the <code>script</code> in question I'm able to do all that I want to do except prove that an email exists in the database. I know I'm missing something, leaving something out. In this question I'm only showing the code that doesn't work. The rest of the <code>script</code> works. I think the issue is in the <code>if</code> statement, but I just can't seem to figure it out.</p>

<pre class="lang-php prettyprint-override"><code>if(empty($_POST['email']))
{

    $query_email = "
         SELECT
         email
         from users
         where
         email = :email
    ";

    $query_goes = array(

    ':email' =&gt; $_POST['email']

    );
    try
    {

        $stmt = $db-&gt;prepare($query_email);
        $result = $stmt-&gt;execute($query_goes);
    }
    catch (PDOException $ex)
    {
        die("Failed to run query: " . $ex-&gt;getMessage());
    }
    $row = $stmt-&gt;fetch();
    if($row) 
    {
        die("This email is already in use...");
    }

}

}
</code></pre>