c19h28o2 Posted January 21, 2007 Share Posted January 21, 2007 Hi,I've installed pear via pear install db and appears to have installed correctly, however i'm going through Learning PHP and MySQL, the below code should use pear db but it does not work. I"m running php5 on osx I don't receive an error the page is blank when its run. mysql and php is setup correctly as it scripts run fine without db.This is the code....[code]<?phpinclude('db_login.php');require_once( 'DB.php' );$connection = DB::connect( "mysql://$db_username:$db_password@$db_host/$db_database");if (!$connection){ die ("Could not connect to the database: <br>". DB::errorMessage());};$query = 'CREATE TABLE `purchases` ( `purchase_id` int(11) NOT NULL auto_increment, `user_id` varchar(10) NOT NULL, `title_id` int(11) NOT NULL, `purchased` timestamp NOT NULL, PRIMARY KEY (`purchase_id`))';echo ("Table created successfully!");$result = $connection->query($query);if (DB::isError($result)){ die ("Could not query the database: <br>". $query. " ".DB::errorMessage($result));}$connection->disconnect();?>[/code]Thanks for your help Link to comment https://forums.phpfreaks.com/topic/35089-pear-db-install-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.