Find if Update happened or not in PDO Php -


i using following code update query. suppose ability value 0 , update didn't happen. how can find out?

$statement = $conn->prepare ('update players set                     ability = ability - 1 id = :playerid , ability > 0');  $statement->bindparam (':playerid', $player['id'],pdo::param_int);  $statement->execute(); 

$stmt = $conn->prepare("update....."); $stmt->execute(array($var, $var)); 

now, if want check success update..

if($stmt->rowcount() > 0){     //means updated }else{    //means not updated } 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -