2

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?

Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
mdarling
  • 77
  • 1
  • 13

1 Answers1

2

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

 $crud->where('status','open');
 $crud->or_where('posting_date <',$now);
Saty
  • 22,443
  • 7
  • 33
  • 51
  • Is the below statement correct. I want to filter data by date range. $code->where('time_in >=',$fromDate); $code->where('time_in <= ',$toDate); – Vinay Sikarwar May 15 '20 at 07:36