I have the following PHP snippet which should return false when the WHERE clause doesn't match. For ex: I don't have any selector value with ghddd in the database so it is supposed that the update shouldn't take place and I should get Failure but I keep getting Success. Where am I doing wrong?
if(isset($_COOKIE['authUser'])) {
$cookie_contents = $_COOKIE['authUser'];
//list($selector, $plain_token) = explode(':', $cookie_contents);
$selector = "ghddd";
//Empty the values
$query = $dbh->prepare("UPDATE auth_tokens SET token=:token, expires=:expires WHERE selector = '".$selector."'");
if($query->execute(array(
":token" => "",
":expires" => ""
))) {
echo 'Success';
}
else {
echo 'Failure';
}
// Delete the authentication cookie
//setcookie('authUser', "", time() - 1);
}