What are the best practices for updating Mysql cell types to only allow integer values?

To update MySQL cell types to only allow integer values, you can alter the column to use the INT data type. This will ensure that only whole numbers can be stored in the column, preventing any non-integer values from being inserted. Additionally, you can add a validation check in your application logic to ensure that only integer values are submitted for insertion.

// Connect to MySQL database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

$conn = new mysqli($servername, $username, $password, $dbname);

// Update column to only allow integer values
$sql = "ALTER TABLE table_name MODIFY column_name INT";
$conn->query($sql);

// Close connection
$conn->close();