query("SHOW TABLES LIKE 'users'"); if ($stmt->rowCount() == 0) { $sql = "CREATE TABLE users ( id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"; $pdo->exec($sql); echo "Table 'users' created successfully." . PHP_EOL; } else { echo "Table 'users' already exists." . PHP_EOL; } } catch (PDOException $e) { die("Could not connect to the database or create table: " . $e->getMessage()); }