//this my config db:
'dsn' => '',
'hostname' => '10.***.***.*',
'username' => 'username',
'password' => 'password',
'database' => 'mydb',
'dbdriver' => 'sqlsrv',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => FALSE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => FALSE
//my model
class Mod_login extends CI_Model{
function Aplikasi(){
$sql = "SELECT * FROM aplikasi";
$data = $this->db->query($sql);
var_dump($data);
die();
if (!$data) {
return false;
} else {
return $data;
};
}
}
//and this is my controller
public function index()
{
$logged_in = $this->session->userdata('logged_in');
if ($logged_in == TRUE) {
redirect('dashboard');
} else {
$aplikasi['aplikasi'] = $this->Mod_login->Aplikasi();
$this->load->view('admin/login_data', $aplikasi);
}
}
hi, im newbie and have troble with my connection to sqlsrv, i already download extension for php 8.02, make it sure my username and pass cant access the table, but still cant get the result, its really depresing
CodePudding user response:
Try this
class Mod_login extends CI_Model{ function Aplikasi(){
$sql = "SELECT * FROM aplikasi";
$data = $this->db->query($sql);
var_dump($data>result_array());
die();
if (!$data) {
return false;
} else {
return $data;
};
}
CodePudding user response:
If you have "Message: Call to a member function result_array() on bool" you probably didn't load the database class
Read this Initializing the Database Class
or see what he shows var_dump($this->db)