How to find active and expired users, compare dates in Codeigniter?

advertisements
Tablename :- userinfo
Column :- expiration [ type:- text ]
Date format :- date('d M Y')
Database :- MySQL
Tech :- Codeigniter 3

Table contains record of users and I want to filter result through expiration date.

Active users :- $exp_date > $cur_date;
Expired users :- $exp_date < $cur_date;


Use OR to get the "Unlimited" value:

<?php
$this->db->select('*');
$this->db->from('userinfo');
$this->db->where('expiration <', $cur_date); // for expired users
                 OR
$this->db->where('expiration >', $cur_date); // for active users
$this->db->or_where('expiration', $unlimited_value); // or_where
?>