开发者

Codeigniter select multiple rows?

开发者 https://www.devze.com 2022-12-16 21:05 出处:网络
How do I select multiple rows from SQL? ie.$results->row(1,2,3,4,5,10开发者_StackOverflow中文版)Are you using ActiveRecord? If so, you can use the where_in() method when making your query. It\'s not

How do I select multiple rows from SQL?

ie. $results->row(1,2,3,4,5,10开发者_StackOverflow中文版)


Are you using ActiveRecord? If so, you can use the where_in() method when making your query. It's not something you do after the query is finished, as you seem to be doing in your example.

$this->db->where_in('id', array(1,2,3,4,5,10));
$query = $this->db->get('myTable');
// This produces the query SELECT * FROM `myTable` WHERE `id` IN (1,2,3,4,5,10)

See the this CodeIgniter docs section for more info on SELECT statement support.

0

精彩评论

暂无评论...
验证码 换一张
取 消