dkoolgeek Posted December 4, 2006 Share Posted December 4, 2006 I am creating a website for a school project.When I attepmt to run the following code, I get an error.I think it may have something to do with pear but I am not sure.<?phprequire_once 'DB.php';$db_engine = 'mysql';$db_user = 'username';$db_pass = 'password';$db_host = 'localhost';$db_name = 'database';$datasource = $db_engine.'://'. $db_user.':'. $db_pass.'@'. $db_host.'/'. $db_name;$db_object = DB::connect($datasource, TRUE);/* assign database object in $db_object, if the connection fails $db_object will containthe error message. */// If $db_object contains an error:// error and exit.if(DB::isError($db_object)) { die($db_object->getMessage());}$db_object->setFetchMode(DB_FETCHMODE_ASSOC);// we write this later on, ignore for now.include('check_login.php');?> Link to comment https://forums.phpfreaks.com/topic/29345-pear-installation-and-database/ Share on other sites More sharing options...
radalin Posted December 4, 2006 Share Posted December 4, 2006 What is the error code? And also instead of DB you should use MDB2. it's like an newer version of DB and it's recommended. If the error is something about DB:Error then you should check the validity of your connection string. Try echoing it and look if anything is wrong Link to comment https://forums.phpfreaks.com/topic/29345-pear-installation-and-database/#findComment-134753 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.