RE: Problem connecting to database.
| From: | Sean Chambers | Date: | Tue, 02 Jul 2002 14:58:51 +0000 |
| Subject: | RE: Problem connecting to database. | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-1790@lists.php.net to get a copy of this message | ||
Here is what I get:
[db_error: message="DB Error: not found" code=-4 mode=return
level=notice prefix="" info=""]
Doesn't make much sense to me.
By the way, thank you for the very informative pear tutorial. I use it
as a reference on a regular basis!
-----Original Message-----
From: Tomas V.V.Cox [mailto:cox@idecnet.com]
Sent: Tuesday, July 02, 2002 10:58 AM
To: Sean Chambers
Subject: Re: Problem connecting to database.
Sean Chambers wrote:
>
> System stats:
> MySQL with PHP 4.1 on redhat 7.2
> PHP is running as cgi; not as an apache module
>
> Here is the problem I am having:
> I can connect fine using the following:
> $conn = mysql_connect($db_host,$db_user,$db_pass);
> if (!$conn) {
> echo mysql_error();
> }
>
> But when I attempt to do the following it tells me: DB Error: not
> found
>
> $dsn = $db_type.'://'.$db_user.':'.$db_pass.'@'. $db_host
> .'/'.$db_name; $db = DB::Connect($dsn); if (DB::isError($db)) {
> die ($db->getMessage());
^^^^^^^^^^^^^^^^^
Change that with $db->toString() and read the error message.
> }
> $db->setFetchMode(DB_FETCHMODE_ASSOC);
>
Tomas V.V.Cox