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
Post a Comment