如何检查PDO中是否存在数据库表?

时间:2017-06-06 05:50:29

标签: pdo doctrine-orm native

这样的事情:

$connection->executeQuery('check table historial1 in database $connection->executeQuery('show tables')')

1 个答案:

答案 0 :(得分:0)

 $sql = "SHOW TABLES 'Table_Name' ";
    if($this->is_connected)
    {
        $query = $this->pdo->query($sql);
        return $query->fetchAll(PDO::FETCH_COLUMN);
    }
    return FALSE;