Search code examples
phpmysqlactiverecordphpactiverecord

php.activerecord does a wildcard not work?


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


Solution

  • 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%'