开发者

Codeigniter select multiple rows?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜