Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Problem with And where in ORM Query
  • EDIT:

    Fixed : 
    \Concours\Model_Concours::query()
                    ->where('date_debut', '<=', \DB::expr('NOW()'))
                    ->where('date_fin', '>=', \DB::expr('NOW()'))->get();

    Thanks

    ---------------

    Hi,

    can you explain me why it's doesn't match result :

    \Concours\Model_Concours::query()
                    ->where('date_debut', '<=', 'NOW()')
                    ->and_where_open()
                    ->where('date_fin', '>=', 'NOW()')
                    ->and_where_close()->get();

    OR

    \Concours\Model_Concours::query()
                    ->where('date_debut', '<=', 'NOW()')
                    ->where('date_fin', '>=', 'NOW()')->get();


    And this query work and match result :

    \DB::query('SELECT * 
                    FROM  `concours` 
                    WHERE  `date_debut` <= NOW() 
                    AND  `date_fin` >= NOW()')->as_object('\Concours\Model_Concours')->execute()->as_array();

Howdy, Stranger!

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