• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get Records Older than Today

#1
Hi,

Im saving the records with 'register date'. now i need to call all the records which are in future (from today).

for example:
My DB : 01-05-2014, 22-10-2015, 25-11-2015, 05-02-2016 & ...
Today is 20-10-2015
Display => 22-10-2015, 25-11-2015, 05-02-2016 & ...

Thank you guys for your help
Reply

#2
Hi,

Have you tried something like:

Get todays date in date format:
Code:
  $today = date('Y-m-d');

Use in query builder to test for date:
Code:
  $this->db->where('register_date >', $today);

I have not tested this but it should work. I am sure I do similar things in all my sites all the time and it works fine.

Hope that helps,

Paul.
Reply

#3
PauID is right, just add the '=' after '>' since you start displaying 'from today'. See below code:

PHP Code:
$this->db->where('register_date >= '$today); 
Reply

#4
Yes it works, thanks guys
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.