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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -