Look at this example from PEAR documentation:
<?php
require_once 'DB.php';
$user = 'foo';
$pass = 'bar';
$host = 'localhost';
$db_name = 'clients_db';
// Data Source Name: This is the universal connection string
$dsn = "mysql://$user:$pass@$host/$db_name";
// DB::connect will return a PEAR DB object on success
// or an PEAR DB Error object on error
$db = DB::connect($dsn, true);
// Alternatively: $db = DB::connect($dsn);
// With DB::isError you can differentiate between an error or
// a valid connection.
if (DB::isError($db)) {
____die ($db->getMessage());
}
....
// You can disconnect from the database with:
$db->disconnect();
?>
Can't see where they creates the db object?
Isn't this missing?
$db = new DB;
And the last row could be?
DB::disconnect()
I'm getting very confused with the :: thing?
Where have -> gone?
Can anyone explain?