mirror of
https://github.com/dg/dibi.git
synced 2025-08-08 23:26:49 +02:00
throwing exception on connect
This commit is contained in:
@@ -2,12 +2,19 @@
|
||||
|
||||
require_once '../dibi/dibi.php';
|
||||
|
||||
// connects using DSN
|
||||
$state = dibi::connect('driver=mysql&host=localhost&username=root&password=xxx&database=test&charset=utf8');
|
||||
|
||||
try {
|
||||
// connects using DSN
|
||||
dibi::connect('driver=mysql&host=localhost&username=root&password=xxx&database=test&charset=utf8');
|
||||
|
||||
} catch (DibiException $e) {
|
||||
echo "DibiException: " . $e->getMessage();
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
// connects to mysql
|
||||
$state = dibi::connect(array(
|
||||
dibi::connect(array(
|
||||
'driver' => 'mysql',
|
||||
'host' => 'localhost',
|
||||
'username' => 'root',
|
||||
@@ -44,7 +51,6 @@ dibi::connect(array(
|
||||
// check status
|
||||
if (!dibi::isConnected()) {
|
||||
echo 'dibi::isConnected(): Not connected';
|
||||
echo "<br>\n";
|
||||
} else {
|
||||
echo 'Connected';
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ dibi::$debug = true;
|
||||
|
||||
// mysql
|
||||
dibi::connect(array(
|
||||
'driver' => 'mysqli',
|
||||
'driver' => 'mysql',
|
||||
'host' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => 'xxx', // change to real password!
|
||||
@@ -16,10 +16,6 @@ dibi::connect(array(
|
||||
));
|
||||
|
||||
|
||||
if (!dibi::isConnected())
|
||||
die('Not connected');
|
||||
|
||||
|
||||
$res = dibi::query('SELECT * FROM table');
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user