Search code examples
phpcodeignitergrocery-crud

Grocery Crud where date greater than today


I'm trying to display results in Grocery Crud where the posted date is greater than today, with no luck. Here is what I tried:

$crud->where('status','open');
$crud->or_where('posting_date','<'.$now);

The table returns results, but it just returns all results. $now is set like so:

$dt = new DateTime();
$now = $dt->format('Y-m-d H:i:s');

Am I missing something?


Solution

  • you use Wrong less then condition in codeigniter it would be like this

     $crud->where('status','open');
     $crud->or_where('posting_date <',$now);