RE: [PHP] Re: [PEAR] Trying to install Log

From: Date: Mon, 16 Jun 2003 03:14:56 +0000
Subject: RE: [PHP] Re: [PEAR] Trying to install Log
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5976@lists.php.net to get a copy of this message
Stan try the following code, I have a feeling that the db connection is failing: <?php ini_set("include_path","/usr/share/pear/"); require_once("DB.php"); include("functions/connect.mn.php"); $dsn = $server://$user:$password@$host/$database $db = DB::connect($dsn); if (DB::isError($db)) { die ($db->getMessage()); } $sql = "SELECT * FROM ps_config WHERE site=1"; if ( DB::isError( $result = $db->query( $sql ) ) ) { die ($result->getMessage()); } else { $row = $result->fetchRow(DB_FETCHMODE_OBJECT); } ?> Hope this helps should or at least produce a better error :) Regards, Joseph -----Original Message----- From: Stan Lemon [mailto:insyder@myrealbox.com] Sent: Monday, 16 June 2003 12:23 PM To: php-general@lists.php.net Subject: [PHP] Re: [PEAR] Trying to install Log I'm using the mysql driver, so $server = "mysql"; I am also very confident that mysql support is provided correctly through php because up until recently I've used mysql_....() functions and never experienced a problem. I have no problem connecting, it's just the query() function doesn't want to go, it keeps telling me that no function exists. I tried the code you wrote and it didn't produce any errors. The following code is available at: http://beta.insyderhomielc.com/dbtest.php <.?php // Set the include path for when I'm working with PEAR ini_set("include_path","/usr/share/pear/"); // Grab DB for me include("/usr/share/pear/DB.php"); // My connection info that I use everywhere is in here include("functions/connect.mn.php"); // Now connect me $db = DB::connect("$server://$user:$password@$host/$database"); // Query to the db $query = "SELECT * FROM ps_config WHERE site=1"; $result = $db->query($query) or die("I could not connect to the PageSite configuration table in the SQL database."); // Store the results in an associative array $config = $result->fetchRow(DB_FETCHMODE_ASSOC); ?.> If you need to see my php configuration go to: http://beta.insyderhomielc.com/php.php I'll be honest, I am clueless. I don't have a single problem on my harddrive. This is consistent though, I had the same problem on another CPanel based server. - Stan

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