Welcome Guest, Not a member yet? Register   Sign In
Site online with db offline
#4

For some reason the line numbers in those error messages don't line up for me, but I was forgetting that mysqli dumps errors on its own. If you're using mysqli for all of the connections and don't care about being able to switch to another database driver, you can try something like this:

PHP Code:
// Tell mysqli to throw exceptions instead of errors
mysqli_report(MYSQLI_REPORT_STRICT);

try {
 
   $DB1 $this->load->database('group_one'TRUE);
} catch (
Exception $e) {
 
   // $DB1 failed to connect, or some other exception 
 
   // was thrown while trying to load the database.
}

try {
 
   $DB2 $this->load->database('group_two'TRUE);
} catch (
Exception $e) {
 
   // $DB2 failed to connect, or some other exception 
 
   // was thrown while trying to load the database.

Reply


Messages In This Thread
Site online with db offline - by StratoKyke - 11-12-2015, 04:46 PM
RE: Site online with db offline - by mwhitney - 11-13-2015, 09:44 AM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 09:57 AM
RE: Site online with db offline - by mwhitney - 11-13-2015, 10:46 AM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 11:00 AM
RE: Site online with db offline - by mwhitney - 11-13-2015, 11:24 AM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 11:50 AM
RE: Site online with db offline - by mwhitney - 11-13-2015, 12:08 PM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 12:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB