0
Good,
I am trying to create a login page with Codeigniter.
It turns out, to validate the entered data, I need to fetch information from a MS SQL database through ODBC. When using the Codeigniter query Builder, I get the following error:
Call to Undefined method Ci_db_odbc_driver::select()
What is the reason for this to happen?
Model
class Utilizador_model extends CI_Model {
public function login($username,$password){
$this->db->select('*');
$this->db->from('utilizadores');
$this->db->where('username', $username);
$this->db->where('password', $password);
$q = $this->db->get();
if ($q->num_rows() > 0) {
return $q->result_array();
}else{
return false;
}
}
Which version of CI are you using? From what I remember from version 3.1 it is no longer possible to use the CI Query Builder with ODBC. If using the Builder query, try using SQLSRV (https://www.php.net/manual/en/book.sqlsrv.php) instead of ODBC, it should work.
– Vinicius Gabriel
I’m using the 3.1.10.
– Marco Silva
I tried it without CI query Builder and it’s working
– Marco Silva
So that’s exactly the point. In this version Query Builder no longer works with ODBC, if you don’t use Query Builder it will work normally, or you can use another driver like SQLSRV to use QB.
– Vinicius Gabriel