Loading ...
Sorry, an error occurred while loading the content.

Re: [phpXperts] CodeIgniter pagination problem

Expand Messages
  • Syed Rajib Rahman
    Dear Arafat, Thanks for ur reply. Actually i want to know ..how i can get $cat_id and post it to get_submenu model... cause i am fetching this $id from my
    Message 1 of 3 , Nov 1, 2008
    • 0 Attachment
      Dear Arafat,
       
      Thanks for ur reply. Actually i want to know ..how i can get $cat_id and post it to get_submenu model...
       
      cause i am fetching this $id from my previous page...then i send this $id by url....
       
      but how can i do this?....i already tried several ways but i can not succed yet....
       
      i already tried it by using session
       
      my controller function is:
       
       function special_menu($id)
               {       
                     $a=$this->test_model->get_nrows('3',$this->uri->segment(3),$id);
                     $_SESSION['cat_id'] = $id;
           $this->load->model('test_model');
              $config['base_url'] = base_url().'index.php/Group12_Business/special_menu/';
           $config['total_rows'] = $a;
                 $config['per_page'] = '3';
                   $config['full_tag_open'] = "<div id='pagination'>";
            $config['full_tag_close'] = '</div>';
       
           $this->pagination->initialize($config);
         

                 $data=array();
                 $data['results'] = $this->test_model->get_submenu($config['per_page'],$this->uri->segment(3),$id);  
                
             $this->load->view('view_special_menu_details',$data); 
         
          }
          ==========================================================
       here is my model functions:
       

           function get_submenu($num,$offset,$id)
          { 
          $this->db->select('*');
           $this->db->from('inbook_special_phase_details');
            $this->db->where('cat_id', $id);
            $query = $this->db->get();
             return $query;
           }

          function get_nrows($num,$offset,$id)
          {
           
          $this->db->select('*');
           $this->db->from('inbook_special_phase_details');
            $this->db->where('cat_id', $id);
            $query = $this->db->get();
            $n=$query->num_rows();
             return $n;
      }
       
      cheers
       
      SRR


      From: Arafat Rahman <opurahman@...>
      To: phpexperts@yahoogroups.com
      Sent: Saturday, November 1, 2008 2:45:24 PM
      Subject: Re: [phpXperts] CodeIgniter pagination problem

      Not clear your problem.
      You may easily edit the function signature and pass category id to the function of the model.

      function get_submenu( $num, $offset, $cat_id) {
      ....
      }

      Thanks

      Arafat Rahman
      http://arafatbd. net


    Your message has been successfully submitted and would be delivered to recipients shortly.