Re: db connection problems

From: Date: Thu, 22 Jan 2004 10:39:36 +0000
Subject: Re: db connection problems
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10292@lists.php.net to get a copy of this message
Your $host definition should be the problem. Host must be the sql host, not the http one. Ask this information to your webhosting company. "Arthur Pelkey" <apelkey@northeastquality.com> a écrit dans le message news: 000a01c3deb5$70ae8c00$4a01a8c0@astrotrain... > 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(); > ?>

« previous php.pear.general (#10292) next »