Fetch Record in Last Month / Current Month In Codeigniter

Many times I have faced the issues when fetching records from databases in Codeigniter. The issue is how to fetch data/records for last month or the current month in Codeigniter. But here we have a very simple PHP MySQL code so that you can easily solve it. I also did same way, it works fine for me. Just have a look below codes.



Here Tbl_name is the table where the paid_date is the column. Suppose we need to fetch data last month payment or Current Month paid is paid by customers.

 

This is the example for Last Month Data:

This is the example for Current Month Data:

 



Tags: ,

Advertisements