[eluser]pshah.mumbai[/eluser]
I have created a custom library called "Startup" which checks/loads/initializes all the basic things that I need to have in the application.
I need to do some custom handling if the database connection is not correct. The DB_driver class throws a exception and completely kills off the application. So I have set the db_debug flag to FALSE in database.php file.
Code:
$db['default']['db_debug'] = FALSE;
And in the Startup library it checks if the connection is valid.
Code:
class Startup
{
function Startup()
{
$CI =& get_instance();
if ( ! $CI->db->conn_id) // HERE LIES THE PROBLEM
redirect("install");
The problem is $CI->db->conn_id just checks if it is able to connect to server i.e. hostname, ports are valid. It does not tell if the username/password/dbname is valid or not. Is there any $CI->db method that tells that the username/password/dbname is valid ?