For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > August 2004 > Re: [PEAR] confirming installation









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] confirming installation
Aaron Wormus

2004-08-26, 8:56 am

Bob Leitner wrote:

> All seemed fine until my script had to access the db - I get a DB
> Error: connect failed.


What does your DSN look like? If the regular mysql_* functions work,
then DB should work. I would think that it has to do with an error in
your code or DSN string.

Paste some code.

> If nothing else, how do I get more
> information regarding the error? Like did it fail because of credentials, or
> whatever?


$db = DB::connect($dsn);
if (DB::isError($db)) {
die($db->getMessage());
}

Is that what you're doing?

Aaron
Bob Leitner

2004-08-26, 8:57 pm

Hi Aaron,

in one file I define the DSN, which is using the same variables as I use to
connect using php functions, which is:
$dsn = "mysql://$dbusername:$dbuserpassword@$dbhost/$default_dbname";


in another file I include the above file, have the require_once 'DB.php';,
and the connection call is:
$db = DB::connect($dsn);
if (DB::isError($db)) {
die ($db->getMessage());
}

$sql1 = "SELECT options FROM elements WHERE name = '$element_name'";

$result1 = $db->query($sql1);
if (DB::isError($result1)) {
die ($result1->getMessage());
}*/
$result1 = mysql_query($sql1);
if (!$result1) error_message(sql_error());

//$data1 = $result1->fetchRow(DB_FETCHMODE_ASSOC);

fairly straight forward, and it worked fine when everything was set up on my
local laptop. I thought it might have something to do with PEAR because I
can connect using the same variables with php funcitons.

Anything you see wrong? Or any other thoughts?

thanx,
bob


"Aaron Wormus" <aaron@wormus.com> wrote in message
news:412E14D0.1010902@wormus.com...
> Bob Leitner wrote:
>
>
> What does your DSN look like? If the regular mysql_* functions work,
> then DB should work. I would think that it has to do with an error in
> your code or DSN string.
>
> Paste some code.
>
credentials, or[color=darkred]
>
> $db = DB::connect($dsn);
> if (DB::isError($db)) {
> die($db->getMessage());
> }
>
> Is that what you're doing?
>
> Aaron

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com