Opens a new connection to a named database server.
Connection resource or object.
<?php
/**
PHP 5.4/5.5 Drivers
CUBRID: cubrid
Firebird: firebird
MariaDB: mariadb or mysql
MySQL: mysql
Oracle: oracle
Postgres: pgsql
SQLite3: sqlite
SQL Server: sqlsrv
PHP 5.6 Drivers
Firebird: firebird
MariaDB: mariadb or mysql
MySQL: mysql
Oracle: oracle
Postgres: pgsql
SQLite3: sqlite
SQL Server: sqlsrv
*/
try
{
$dbh = new objSQL( "mysql,localhost,root,pass,mydb,3306" );
if ( error_get_last() !== null )
throw new Exception( error_get_last()['message'] );
//Query block
$dbh->obj_close();
}
catch ( Exception $e )
{
echo $e->getMessage();
}
try
{
$dbh = new objSQL( array( "mysql","localhost","root","pass","mydb",3306 ) );
if ( error_get_last() !== null )
throw new Exception( error_get_last()['message'] );
//Query block
$dbh->obj_close();
}
catch ( Exception $e )
{
echo $e->getMessage();
}
?>