Re: is there a way to get more info about *why* the initial (DB PEAR) connect to db is failing?

From: Date: Sat, 04 Jul 2009 02:04:26 +0000
Subject: Re: is there a way to get more info about *why* the initial (DB PEAR) connect to db is failing?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-294873@lists.php.net to get a copy of this message
On Jul 3, 2009, at 7:31 PM, Govinda <govinda.webdnatalk@gmail.com> wrote:
my code: require 'DB.php'; // $db=DB::connect('db_program://user:password@hostname/database'); if (DB::isError($db)) { die("Can't connect: " . $db->getMessage()); } is returning: "Can't connect: DB Error: connect failed" Any advise to find out WHY this is failing? (Note: I am fairly new to PHP, and brand spanking new at anything db-related with PHP.) thanks, Govinda -- P.S. I realize this had probably been covered countless times (best step by step advice how to troubleshoot the first connection to a mysql db), so i first did try to search the php list archives, here: http://marc.info/?l=php-general&w=2&r=1&s=db+connect&q=b and I am apparently missing something because when I input "failed db connection" at the top, in the search box, then it returns posts all over the map, and also takes out the middle word in my search string (so now it is just "failed db"). Why is that? I also searched for "failed database connection" which does not change my search input, but still the posts I found did not give me enough clue to stop me from posting here now. --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
It's usually a simple thing since there are only 3 parameters so it's something that you have likely mis-spelled or input in the wrong order. It's not rocket science to figure it out, the docs are clear about how it works. But a likely guess maybe that you need to connect via localhost instead of the full domain name. $db=DB::connect('mysql://metheuser:mypass@localhost/mydatabase'); Bastien Sent from my iPod

« previous php.general (#294873) next »