I need to make a query to return only active records which in this case are imo_status
== 1
What is the best way to make this query? I’m using CI3
Below is the source code.
// LISTA OS AGENCIAMENTOS NO BANCO DE DADOS
public function getProperties()
{
$this->db->select('*');
$this->db->from('ci_properties');
$this->db->where('imo_status' == 1);
return $this->db->get("ci_properties")->result_array();
/*$query = $this->db->get("ci_properties");
return $query->result_array();*/
}
2
Answers
I solved this
You build the query then don’t use it:
This wipes out the query builder and basically does a ‘get all’ from ‘ci_properties’. To use you’re query:
This is because you have already specified the table in the ‘from’ part, get(‘table name’), will get all.