CodeIgniter Forums
Pagination & slug - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Pagination & slug (/showthread.php?tid=64316)



Pagination & slug - red099 - 02-07-2016

I'm a newbie. help me please. learn in a textbook. Make the news - and it works. But with the pagination problem. How good is my code in the model?


PHP Code:
class News_model extends CI_Model {

 
       public function __construct()
 
       {
 
               $this->load->database();
 
       }
 
       
        public 
function get_news_page($slug FALSE)
 
       {
 
       
                $query 
$this->db->get_where('news', array('slug' => $slug));
 
               return $query->row_array();
 
       }
 
       
        public 
function get_news_front($num,$offset)
 
       {

 
               $this->db->order_by('id','desc');
 
               $query $this->db->get('news',$num,$offset);
 
               return $query->result_array();

 
       }