public function createConnection($parameters)
    {
        $connection = new \PDO(
            'mysql:host=' . $parameters['host'] . ';dbname=' . $parameters['database'],
            $parameters['username'],
            $parameters['password']
        );

        if (isset($parameters['charset'])) {
            $connection->exec('SET CHARACTER SET ' . $parameters['charset']);
        }

        return $connection;
    }
public function createConnection($parameters)
    {
        $connection = new \PDO(
            'mysql:host=' . $parameters['host'] . ';dbname=' . $parameters['database'],
            $parameters['username'],
            $parameters['password']
        );

        if (isset($parameters['charset'])) {
            $connection->exec('SET CHARACTER SET ' . $parameters['charset']);
        }

        return $connection;
    }
public function createConnection ( $ parameters ) { $ connection = new \ PDO ( 'mysql:host=' . $ parameters [ 'host' ] . ';dbname=' . $ parameters [ 'database' ] , $ parameters [ 'username' ] , $ parameters [ 'password' ] ) ; if ( isset ( $ parameters [ 'charset' ] ) ) { $ connection -> exec ( 'SET CHARACTER SET ' . $ parameters [ 'charset' ] ) ; } return $ connection ; }
Creates a MySql Connection

@param array $parameters Connection parameters
<pre>
host: eg. localhost
database: eg. my_app
username: eg. root
password: eg. 123456
charset:  (Optional)
</pre>

@return \PDO
Creates a MySql Connection