how to show different row in different page from db |
[eluser]xpeed[/eluser]
hello i just like to know how i can show second row from db. and another page 3rd row from db This controller for view data from model public function view_main_body() { $data = array(); $data['main_body_details'] = $this->sa_model->select_main_body(); $data['admin_content'] = $this->load->view('admin/view_page_content', $data, true); $this->load->view('admin/index', $data); } here is the model which show data from database public function select_main_body() { $this->db->select('*'); $this->db->from('tbl_main_body'); $result_query = $this->db->get(); $result = $result_query->row(); return $result; } here is the welcome controller which show in frontpage public function index() { $data=array(); $data['menu_details'] = $this->sa_model->select_menu(); $data['maincontent']=$this->load->view('home_message',$data,true); $this->load->view('index',$data); } i can show with foreach loop <?php echo $main_body_details->main_body; ?> this is code show fast row result but i want to show my second row from db. another page 3rd row from db Thanks in advance
[eluser]Tpojka[/eluser]
Using MySQL LIMIT? Code: $query = $this->db->get('mytable', 1, 1); // first numbes means row index (second row), second number means how many rows from it User guide.
[eluser]xpeed[/eluser]
hello i just like to show second row from db. how i can ?? Thanks
[eluser]Tpojka[/eluser]
What error you get when useing code I posted before?
[eluser]xpeed[/eluser]
Code: Error Number: 1066 this error showing
[eluser]Tpojka[/eluser]
In your model make another method and place next code to it: Code: $query = $this->db->get('tbl_main_body', 1, 1); |
Welcome Guest, Not a member yet? Register Sign In |