public/include/Conn.php
public function createDatabase()
    {
        try {
            $dsn = 'mysql:host=' . $this->host . ';';
            $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("CREATE DATABASE {$this->database}");
            $command->execute();

        } catch (\PDOException $e) {
            return false;
        }
    }
public function createDatabase()
    {
        try {
            $dsn = 'mysql:host=' . $this->host . ';';
            $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("CREATE DATABASE {$this->database}");
            $command->execute();

        } catch (\PDOException $e) {
            return false;
        }
    }
public function createDatabase ( ) { try { $ dsn = 'mysql:host=' . $ this -> host . ';' ; $ 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 ( "CREATE DATABASE {$this->database}" ) ; $ command -> execute ( ) ; } catch ( \ PDOException $ e ) { return false ; } }
Cria a database informada no construtor
Cria a database informada no construtor