This is my code:
$query = "CREATE TABLE IF NOT EXISTS `data`(`id` INT(11) AUTO_INCREMENT, `car` INT(11), PRIMARY KEY(id))";
try {
$stm = self::$connection->query($query);
echo 'done';
} catch (PDOException $e) {
echo $e->getMessage();
}
This code work fine, but if table is exists, PDO not return any error for me.
I want this code:
if ($stm) {
echo "not exists and create table";
} else {
echo "exists!"
}