public/include/Conn.php
public function databaseIsEmpty()
    {
        try {
            $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database;
            $options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
            $connect = new \PDO($dsn, $this->user, $this->pass, $options);
            $connect->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

            $command = $connect->prepare("show tables");
            $command->setFetchMode(\PDO::FETCH_ASSOC);
            $command->execute();
            return empty($command->fetchAll());

        } catch (\PDOException $e) {
            return false;
        }
    }
public function databaseIsEmpty()
    {
        try {
            $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database;
            $options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
            $connect = new \PDO($dsn, $this->user, $this->pass, $options);
            $connect->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

            $command = $connect->prepare("show tables");
            $command->setFetchMode(\PDO::FETCH_ASSOC);
            $command->execute();
            return empty($command->fetchAll());

        } catch (\PDOException $e) {
            return false;
        }
    }
public function databaseIsEmpty ( ) { try { $ dsn = 'mysql:host=' . $ this -> host . ';dbname=' . $ this -> database ; $ options = [ \ PDO :: MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8' ] ; $ connect = new \ PDO ( $ dsn , $ this -> user , $ this -> pass , $ options ) ; $ connect -> setAttribute ( \ PDO :: ATTR_ERRMODE , \ PDO :: ERRMODE_EXCEPTION ) ; $ command = $ connect -> prepare ( "show tables" ) ; $ command -> setFetchMode ( \ PDO :: FETCH_ASSOC ) ; $ command -> execute ( ) ; return empty ( $ command -> fetchAll ( ) ) ; } catch ( \ PDOException $ e ) { return false ; } }
Verifica se database esta vazia
Verifica se database esta vazia