I have error message when try to access my controller
PHP Code:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: controllers/Test.php
Line Number: 94
this is my controller in CodeIgniter 2.x and worked :
PHP Code:
$dsn = $_POST['mysql_db_driver'].'://'.$_POST['db_username'].':'.$_POST['db_password'].'@'.$_POST['mysql_db_host'].'/'.$_POST['mysql_db_name'];
$this->db = $this->load->database($dsn, TRUE);
if (!empty($this->db) && $this->db->conn_id !== FALSE) {
$db_error = $this->db->_error_message();
if(!file_exists(FCPATH.'sample.sql')) {
$db_error.= '<br /'.$this->db->_error_message();
}
and I change it in CodeIgniter 3.0 to :
PHP Code:
$dsn = $_POST['mysql_db_driver'].'://'.$_POST['db_username'].':'.$_POST['db_password'].'@'.$_POST['mysql_db_host'].'/'.$_POST['mysql_db_name'];
$this->db = $this->load->database($dsn, TRUE);
if (!empty($this->db) && $this->db->conn_id !== FALSE) {
$db_error = $this->db->error();
if(!file_exists(FCPATH.'sample.sql')) {
$db_error.= '<br /'.$this->db->error();
}
Line number 94 is
$db_error = $this->db->error();
Please help me