[eluser]bhakti.thakkar[/eluser]
hi all,
i have integrated PEAR in CI. i have placed the required file in application/libraries/Dbconnect.php myDB connection is mentioned in this file. and entire pear folder in application/ folder
in autoload file i have autoloaded:
$autoload['libraries'] = array('session','Pearloader','dbconnect');
All is working file
i am able to work with pear functions well. but the only thing of concern is in every controller or model, while interacting to DB, i need to do this:
$conn = & $this->dbconnect->connect();
for example :
class Agency_Model extends Model
{
function __Construct()
{
parent::Model();
}
function get_all_agencys()
{
$conn = & $this->dbconnect->connect();
$sql = "SELECT Agency_code from Maritime_Agency";
$rs = $this->Dbconnect->getAll($sql, DB_FETCHMODE_ASSOC);
return $rs;
}
}
why do i need to mention the connect() function every time? i have autoloaded the library. where am i going wrong?
Thanks