0
votes

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

3
Did you read the error messages? application/errors/error_php.php doesn't exist on your server, or is otherwise unreadable.Marc B
@MarcB How to solve this?beginner
just create an error_php.php file in your application/errors/ folder, I guess this is supposed to deal with displaying errors to the user in a friendly way. As the messages above are just warnings, the code should still run until something tries to call a function that's supposed to be present in error_php.phpLoopo
@Loopo Yeah you are correct.beginner

3 Answers

1
votes

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.

1
votes

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');

1
votes

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.