What are the best practices for handling numeric values in database updates using prepared statements in PHP?

When updating numeric values in a database using prepared statements in PHP, it is important to bind the parameters with the appropriate data type to ensure data integrity and prevent SQL injection attacks. To handle numeric values, you should use the PDO::PARAM_INT constant when binding the parameters.

// Assuming $pdo is your PDO connection object

$value = 123; // Numeric value to be updated

$stmt = $pdo->prepare("UPDATE table SET column = :value WHERE id = :id");
$stmt->bindParam(':value', $value, PDO::PARAM_INT);
$stmt->bindParam(':id', $id, PDO::PARAM_INT);
$stmt->execute();