RsD0p9BK
11/8/2016 - 4:41 AM

pdo__affected_rows.php

// PDO were rows affected during execute statement

$pdo = new PDO($dsn, $username, $password);
$sql = "UPDATE tb_users SET authState=1 WHERE id = ? AND authPass = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute(array($id, $authPass));

if ($stmt->rowCount()){
    echo 'Success: At least 1 row was affected.';
} else{
    echo 'Failure: 0 rows were affected.';
}

// http://stackoverflow.com/questions/10522520/pdo-were-rows-affected-during-execute-statement
// http://php.net/manual/ru/pdostatement.rowcount.php