How can the SQL statement in the PHP code snippet be modified to directly update the 'credits' column without subtraction in the UPDATE query?

The SQL statement in the PHP code snippet can be modified to directly update the 'credits' column without subtraction by using a different syntax in the UPDATE query. Instead of subtracting a value from the current 'credits' column value, we can set the 'credits' column directly to the new value we want it to be updated to.

$user_id = 123;
$new_credits = 150;

$sql = "UPDATE users SET credits = :new_credits WHERE user_id = :user_id";

$stmt = $pdo->prepare($sql);
$stmt->bindParam(':new_credits', $new_credits, PDO::PARAM_INT);
$stmt->bindParam(':user_id', $user_id, PDO::PARAM_INT);
$stmt->execute();