Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Advance Query When Using ORM
  • Said that i have Model_Post that had relation in Model_User. When we do $query = Model_Post::find() ;
    $query->where($field, 'like','%search%' ) ; we might have error if we do something look alike $query->where('LEFT(FROM_UNIXTIME(`t0`.`created_at`),10)', 'like','%search%' ) ; in the where function. The solution is to use the expr() function inside the where and place those 1st argument onto
    the expr() function. so it will be. $query->where(DB::expr('LEFT(FROM_UNIXTIME(`t0`.`created_at`),10)' ), 'LIKE',"%{search}%" ) ;

Howdy, Stranger!

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