Reputation: 673
i have two database in a single project. I am trying to connect with the second database for generating one query but it is throwing error on my console. Please help me with this problem
Below Model code i used
//---------connecting with 2nd db--------------------------------------------
public function fetch_all_approved_template_list($limit,$start)
{
$dsn = 'mysql://fitappweb:fitappweb@localhost/fitneapp_webapp';
$dsnDB = $this->load->database($dsn, TRUE);
$dsnDB->limit($limit, $start);
$query = $dsnDB->order_by('routine_id', 'DESC')->join('userdetails', 'userdetails.user_id = template_routines.creater_id')->get_where('template_routines',array('status_code'=>'1'));
$data=array();
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}
Error On the browser window
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Upvotes: 0
Views: 2967
Reputation: 2195
error_php.php in a codeigniter application usually contains:
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
</div>
you can place this in your application/errors/error_php.php file. And you will get more details as to what the errors being generated are.
Upvotes: 1
Reputation: 850
Check application/config/databases.php for setting up your database next you can load the database using
$this->load->database('group_name',TRUE);
Read this to manually connect :
http://ellislab.com/codeigniter/user-guide/database/connecting.html
You need to pass an array when loading your DB.
I wouldn't advise connecting manually but your choice.
Upvotes: 1
Reputation: 13
Have you tried setting up the group name in the config file?
After that then you would only have to call it by the group name
$this->load->database('group_name');
Upvotes: 1