1
0
mirror of https://github.com/dg/dibi.git synced 2025-07-31 11:20:25 +02:00

update to 0.6

This commit is contained in:
David Grudl
2006-06-07 15:50:32 +00:00
parent 8361028ff3
commit 0951ea574c
13 changed files with 246 additions and 273 deletions

View File

@@ -2,38 +2,46 @@
require_once '../dibi/dibi.php';
// use two connections:
// first connection to mysql
// connects to mysql
$state = dibi::connect(array(
'driver' => 'mysql',
'host' => 'localhost',
'username' => 'root',
'password' => '***',
'password' => 'xxx', // change to real password!
'database' => 'test',
'charset' => 'utf8',
), 1);
));
if ($state instanceof Exception) {
echo $state;
}
if (!dibi::isConnected()) {
die();
}
// second connection to odbc
/* connects to ODBC
dibi::connect(array(
'driver' => 'odbc',
'username' => 'root',
'password' => '***',
'database' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\Database.mdb',
), 3);
));
*/
echo dibi::isConnected();
// check status
if (!dibi::isConnected()) {
echo 'dibi::isConnected(): Not connected';
echo "<br>\n";
}
// or checked status this way
if (is_error($state)) {
// $state can be FALSE or Exception
if ($state instanceof Exception)
echo $state;
else
echo 'FALSE';
echo "<br>\n";
}