Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 2.x and shutdown database
#1

I have some database connections, and i load database in controller if necessary.
And i want continue my script work, if database is shutdown.
But if some database is shutdown, my script stopped with error: "unable connect to database".
And i'm solve this problem (db_gebug = FALSE), and now my script also stopped and i see error "undefined variable DB2" from model file, this tell me about CodeIgniter db connection not returning FALSE in my var.

My script logic in controller:
> .......
> $DB2 = $this->load->database('db2', TRUE, TRUE);
> if ($DB2) {
> $this->load->model('some_model');
> //actions
> }
> else $data['content'] = 'server now is shutdown';
> .......

Result: var DB2 not gain FALSE, if mysql server is shutdown, and my script logic not work, and i have errors. And if i change "if ($DB2)" to "if (isset($DB2))", it also not work.
How i can fix it?
Reply


Messages In This Thread
CodeIgniter 2.x and shutdown database - by UchihaSV - 01-14-2015, 03:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB