How to pass last month in where condition in PHP codeigniter?
<p>i want to fetch records of last month and last week from my database.</p>

<p>I have login and logout data in database also i have filed called date_data which is the date.</p>

<p>Now i am fetching my data by this:</p>

<pre><code>public function monthly_login($emp_id = NULL)
{

      $emp_id = $this-&gt;session-&gt;userdata('emp_id');

      $this-&gt;db-&gt;select('*');

      $this-&gt;db-&gt;from('daily_data2');

      //$this-&gt;db-&gt;where('MONTH(date_data)', date('1-m'));

      $this-&gt;db-&gt;where('users.emp_id',$emp_id);

      $this-&gt;db-&gt;where('entry &gt;','100');

      $this-&gt;db-&gt;order_by("date_data","ASC");

      $this-&gt;db-&gt;join('users', 'users.emp_id = daily_data2.emp_id','inner');

      $query = $this-&gt;db-&gt;get();



       $res   = $query-&gt;result();        

      return $res;

 }
</code></pre>

<p>I dont know what should i pass in my where condition so that i get last month and last week's data</p>