PEAR::DB not working for PHP My_SQL

A

Anonymous

Guest
Hi,
Trying to use PEAR::DB for my connection.
Can anyone point out where I am going wrong please?

Code:
require_once('DB.php');    // Include the Pear::DB class code
$db = DB::connect('mysql://DB_USER:DB_PASSWORD@DB_HOST/DB_NAME'); 
if (DB::isError($db)) { die('Unable to connect. '.$db->getMessage()); }

Regards,
Mark
 
Please check your php.ini file...
Check the std. include directive and set the directive to the PEAR root directory...
Or you can use ini_set
 
It would be extremely helpful if you could tell us what you mean by "not working". Are you getting an error?
 
Should have said:
No error but nothing is written to the database. I the process continues as normal, the php code is executed but the database connection is not.

The site is hosted on a college server, so I presume that PEAR::DB has been configured correctly on it.
 
considering that PEAR is fine....
try Printing.. the print_r($db);
IT should have one variable as a connection resource.. check if that is present in the first place.
 
Back
Top