douli8040 2011-09-15 01:52
浏览 38
已采纳

php.activerecord做通配符不起作用?

I'm really new to php.activerecord. So bare with my ignorance. Is there a means of doing a wildcard in a query with it? ie: "Some%" and it returns something, someone, somewhat, somewhere...

http://www.phpactiverecord.org

  • 写回答

1条回答 默认 最新

  • douhui2307 2011-09-15 02:19
    关注

    Taken straight from the phpactiverecord documentation

    # fetch all the cheap books!
    Book::all(array('conditions' => 'price < 15.00'));
    # sql => SELECT * FROM `books` WHERE price < 15.00
    
    # fetch all books that have "war" somewhere in the title
    Book::find('all', array('conditions' => "title LIKE '%war%'"));
    # sql => SELECT * FROM `books` WHERE title LIKE '%war%'
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?