title: How to return last record from database in codeigniter?
body: <p>I am trying to get the last date for which I have the data.
  So I want to print the last date in my column date_data.</p>
  
  <p><strong>In Model:</strong></p>
  
  <pre><code>public function last_record()
  { 
      $query = $this-&gt;db-&gt;select('LAST(date_data)');
      $this-&gt;db-&gt;from('date_data');
      return $query;
  }
  </code></pre>
  
  <p><strong>In Controller:</strong></p>
  
  <pre><code>$last_data = $this-&gt;attendance_m-&gt;last_record();
  var_dump($last_data);
  </code></pre>
  
  <p>But I am not getting the desired result </p>