dousongqiang2585 2014-09-23 05:50
浏览 85
已采纳

where子句和使用FuelPHP查询多个ID

Model_Article::query()->where('id', 4);

I'm using FuelPHP. I have query like the above.

And I have an arrays of ID's

$ids = array(1, 2, 4, 8 ...);

How do I apply my array of id's to write this query using that format?

Thanks a lot!

  • 写回答

1条回答 默认 最新

  • doufeng3602 2014-09-23 05:53
    关注

    Feed the 'IN' inside the ->where() to create an IN() clause:

    Model_Article::query()->where('field_name', 'IN', array(1,2,3,4,5))->get();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?