I have a command to create table in the database. I want to know whether a new table is created or not. Below given is my command.
$command = $connection->createCommand(
"
CREATE TABLE IF NOT EXISTS `".$tbName."` LIKE `question`;
INSERT INTO `".$tbName."` SELECT * FROM `question`;
"
)->execute();
echo $command;
if($command!==0){
echo "Success";}
else echo "Table already created";
But this always prints "Table already created" even if it is not there in the database.