Re: Problem connecting to database.
| From: | Tomas V.V.Cox | Date: | Tue, 02 Jul 2002 14:58:27 +0000 |
| Subject: | Re: Problem connecting to database. | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1789@lists.php.net to get a copy of this message | ||
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