We will learn How to get last record from MySQL table in Codeigniter?

$this->load->database();
$last = $this->db->order_by('id',"desc")
		->limit(1)
		->get('items')
		->row();
print_r($last);

You can easily use above Codeigniter database query for fetch single record.