how to show different row in different page from db - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: how to show different row in different page from db (/showthread.php?tid=59860) |
how to show different row in different page from db - El Forum - 11-30-2013 [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 how to show different row in different page from db - El Forum - 11-30-2013 [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. how to show different row in different page from db - El Forum - 11-30-2013 [eluser]xpeed[/eluser] hello i just like to show second row from db. how i can ?? Thanks how to show different row in different page from db - El Forum - 11-30-2013 [eluser]Tpojka[/eluser] What error you get when useing code I posted before? how to show different row in different page from db - El Forum - 11-30-2013 [eluser]xpeed[/eluser] Code: Error Number: 1066 this error showing how to show different row in different page from db - El Forum - 11-30-2013 [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); |