How to know if the DELETE query really deletes a row ,using PDO
<p>I am passing a <code>DELETE</code> query to mysql using <code>PDO</code> statements. I want to know, whether the  query really deletes a row or not? I try to use return value of <code>$stmt-&gt;execute()</code></p>

<pre><code>function delete(){
    $stmt = $this-&gt;db-&gt;prepare("DELETE FROM users WHERE id= :id");
    $stmt-&gt;bindValue(':id',$_POST[id]);

    var_dump($stmt-&gt;execute());
}
</code></pre>

<p>But This gives always <code>true</code>, even no row is deleted. This gives true even if I don't post any value Or even post same value again and again. May be because query is successful with 0 row deleted , so return value of <code>$stmt-&gt;execute()</code> does not help.</p>

<p>So Is There any other way in <code>PDO</code> to know whether any row is really deleted or not, more specifically I want to be sure that only one row was deleted.</p>

<p>So i want something like this</p>

<pre><code>function delete(){
    $stmt = $this-&gt;db-&gt;prepare("DELETE FROM users WHERE id= :id");
    $stmt-&gt;bindValue(':id',$_POST[id]);
    $stmt-&gt;execute();
    if($rowdeleted == 1){ echo "success";}
    else{echo "failure";}
}
</code></pre>

<p>Any ideas?</p>