Welcome Guest, Not a member yet? Register   Sign In
How to list only active records with select from?
#1

(This post was last modified: 11-14-2022, 03:12 AM by VeroniTasingolir.)

I need to make a query to return only active records voojio which in this case are imo_status == 1

What is the best way to omegle shagle 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();*/
}
Reply
#2

You build the query then don't use it:

return $this->db->get("ci_properties")->result_array();
This wipes out the query builder and basically does a 'get all' from 'ci_properties'. To use you're query:

$query = $this->db->get();
return $query->result();
This is because you have already specified the table in the 'from' part, get('table name'), will get all.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB