php - Pdo update not returning false when it should -


i have following php snippet should return false when clause doesn't match. for ex: don't have selector value ghddd in database supposed update shouldn't take place , should failure keep getting success. doing wrong?

if(isset($_cookie['authuser'])) {         $cookie_contents = $_cookie['authuser'];         //list($selector, $plain_token) = explode(':', $cookie_contents);         $selector = "ghddd";         //empty values         $query = $dbh->prepare("update auth_tokens set token=:token, expires=:expires selector = '".$selector."'");         if($query->execute(array(             ":token" => "",             ":expires" => ""         ))) {             echo 'success';         }         else {             echo 'failure';         }         // delete authentication cookie         //setcookie('authuser', "", time() - 1);     } 

if want check if update query has updated 1 or more rows, can use pdostatement::rowcount after execution of query.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -