mysql: get affected row record after update -
i use 2 sql queries row record after update this, example:
step 1: update point user test@gmail.com
$sql = "update user set point=point-:point email=:email"; $result = $conn->prepare($sql); $result->bindvalue(':point', 2); $result->bindvalue(':email', 'test@gmail.com'); $result->execute();
step 2: have use sql query row['point'] after updated
$sql = "select point user email=:email"; $result = $conn->prepare($sql); $result->bindvalue(':email', 'test@gmail.com'); $result->execute(); $row = $result->fetch(pdo::fetch_assoc); echo $row['point'];
so, question is, ther shortcut this? such 1 single query achieve this?
many thanks