try {
$query = $pdo->query("SELECT 1 FROM `classes` LIMIT 1");
} catch (Exception $e) {
$query = $pdo->prepare("CREATE TABLE `classes`(
`ID_class` int(11) AUTO_INCREMENT,
`name` varchar(255),
PRIMARY KEY(`ID_class`))");
$query->execute();
}
Hello.
It doesn't catch, if the table doesn't exist.