mirror of
https://github.com/dg/dibi.git
synced 2025-07-31 03:10:14 +02:00
update to 0.5alpha
This commit is contained in:
40
examples/connect.php
Normal file
40
examples/connect.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
require_once '../dibi/dibi.php';
|
||||
|
||||
// use two connections:
|
||||
|
||||
// first connection to mysql
|
||||
$state = dibi::connect(array(
|
||||
'driver' => 'mysql',
|
||||
'host' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => '***',
|
||||
'database' => 'test',
|
||||
'charset' => 'utf8',
|
||||
), 1);
|
||||
|
||||
if ($state instanceof Exception) {
|
||||
echo $state;
|
||||
}
|
||||
|
||||
if (!dibi::isConnected()) {
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// second connection to odbc
|
||||
dibi::connect(array(
|
||||
'driver' => 'odbc',
|
||||
'username' => 'root',
|
||||
'password' => '***',
|
||||
'database' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\Database.mdb',
|
||||
), 3);
|
||||
|
||||
|
||||
echo dibi::isConnected();
|
||||
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user