Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Find_by and OR
  • Can this be converted to something like "Select * FROM `users` WHERE `name` = "John" OR `surname` LIKE "%Surname%" LIMIT 10"?
    // Select * FROM `users` WHERE `name` = "John" AND `surname` LIKE "%Surname%" LIMIT 10
    $users = \Model_User::find_by(array(
        'name' => 'John',
        array('surname', 'like', '%Surname%'),
    ), null, null, 10);
    

    Thanks,
    Primoz
  • did you find the answer to your problem, mine is the same I want to do the query "SELECT * FROM `sgsses` WHERE `categorie` = 'manuel' and (`langue`='fr OR `langue`='it')" but don't find the good way to write it
    $data = Model_Sgss::find('all', array('where' => array(array('categorie', '=', 'manuel'), array('langue', '=', 'fr'))));
  • @coax, please don't ask the same question in two different threads.
  • @coax, I know how to achieve this result, with standard find() method and chaining it with where and or_where, but I was wondering if it can in be achieved with find_by() function as well. Less typing :)!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion