What are some alternative approaches to managing user statuses in a database table using PHP?

When managing user statuses in a database table using PHP, one alternative approach is to use an ENUM column in the database to store different user statuses. This can help to ensure data integrity and simplify queries that involve user status checks.

// Create a users table with a status column using ENUM datatype
$sql = "CREATE TABLE users (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(30) NOT NULL,
    status ENUM('active', 'inactive', 'pending') NOT NULL
)";

// Insert a new user with a status of 'active'
$sql = "INSERT INTO users (username, status) VALUES ('JohnDoe', 'active')";

// Update a user's status to 'inactive'
$sql = "UPDATE users SET status = 'inactive' WHERE id = 1";

// Retrieve all active users
$sql = "SELECT * FROM users WHERE status = 'active'";