Reputation: 13653
I want to do a trivial SQL query with CodeIgniter, such as "SELECT * FROM mytable WHERE TRUE"
maybe one way could be this :
$this->db->get_where('mytable' , array('42' => '42'));
but "42"="42" seems unnecessary to me. How can I initialize the array so that it (CI) does not do any unnecessary computations ?
Upvotes: 1
Views: 851
Reputation: 8838
if you want to get all rows without any condition, then you can use
$this->db->get("mytable");
There is no need of get_where
because your query SELECT * FROM mytable WHERE TRUE
will always return all records.
Upvotes: 1