my database table looks like below
| id | user_name | address | contact | date | |----|-----------|---------|---------|----------| | 1 | john | NY
I think the best way You can use dateiff to get any query between any two dates by days like this
$result = $this->db->query("SELECT * FROM ".$table." WHERE datediff('". $your_date ."', row_date) <= 15")->get()->result();