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 ?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.