db connection problems
| From: | Arthur Pelkey | Date: | Mon, 19 Jan 2004 17:55:34 +0000 |
| Subject: | db connection problems | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10225@lists.php.net to get a copy of this message | ||
I have had to resort to do the following, because my webhosting company
is unable to respond to my problem of pear/pathing/information within
several days of the originating email/questions. I am just trying to
learn PEAR::DB, and was going through the connection/disconnection intro
here:
http://pear.php.net/manual/en/package.database.db.intro-connect.php
However, I get the following error msg:
"DB Error: not found"
I have used the username/password/host/db_name for almost a year
successfully through just normal mysql functions, so I know they are
there and are functional, what could be causing this?
<?php
ini_set("include_path", '/home/account_name/includes_pear/' .
PATH_SEPARATOR . ini_get("include_path"));
require_once 'DB/DB.php';
$user = 'user_name';
$pass = 'password';
$host = 'www.host_name.com';
$db_name = 'account_name_db_name';
$dsn = "mysql://$user:$pass@$host/$db_name";
$db = DB::connect($dsn);
if (DB::isError($db)) {
die ($db->getMessage());
}
$sql = "SELECT * FROM classes3";
$result = $db->query($sql);
if (DB::isError($result)) {
die ($result->getMessage());
}
$db->disconnect();
?>