php - I will like an assistant with codeigniter pagination -
i need assistant codeigniter pagination.
i have been struggling create week, here code. have controller , view, on view page have table want create pagination below code
controller
<?php /* * **manage members**** */ function member($param1 = '', $param2 = '', $param3 = '') { if ($this->session->userdata('admin_login') != 1) redirect(base_url(), 'refresh'); if ($param1 == 'create') { $data['names'] = $this->input->post('names'); ; $data['birthdate'] = $this->input->post('birthdate'); $data['gender'] = $this->input->post('gender'); $data['email'] = $this->input->post('email'); $data['address'] = $this->input->post('address'); $this->db->insert('member', $data); $member_id = mysql_insert_id(); move_uploaded_file($_files['userfile']['tmp_name'], 'uploads/member_image/' . $member_id . '.jpg'); $this->email_model->account_opening_email('member', $data['email']); //send email account opening email redirect(base_url() . 'index.php?admin/member/', 'refresh'); } if ($param1 == 'do_update') { $data['names'] = $this->input->post('names'); ; $data['birthdate'] = $this->input->post('birthdate'); $data['gender'] = $this->input->post('gender'); $data['email'] = $this->input->post('email'); $data['address'] = $this->input->post('address'); $this->db->where('member_id', $param2); $this->db->update('member', $data); move_uploaded_file($_files['userfile']['tmp_name'], 'uploads/member_image/' . $param2 . '.jpg'); redirect(base_url() . 'index.php?admin/member/', 'refresh'); } else if ($param1 == 'personal_profile') { $page_data['personal_profile'] = true; $page_data['current_member_id'] = $param2; } else if ($param1 == 'edit') { $page_data['edit_data'] = $this->db->get_where('member', array( 'member_id' => $param2 ))->result_array(); } if ($param1 == 'delete') { $this->db->where('member_id', $param2); $this->db->delete('member'); redirect(base_url() . 'index.php?admin/member/', 'refresh'); } $page_data['members'] = $this->db->get('member')->result_array(); $page_data['page_name'] = 'member'; $page_data['page_title'] = get_phrase('manage_member'); $this->load->view('index', $page_data); }
view
<table id="table" class="table table-bordered table-hover datatable"> <thead> <tr> <th><?php echo get_phrase('name'); ?></th> <th><?php echo get_phrase('birthdate'); ?></th> <th><?php echo get_phrase('gender'); ?></th> <th><?php echo get_phrase('email'); ?></th> <th><?php echo get_phrase('address'); ?></th> </tr> </thead> <tbody> <?php foreach ($members_info $row) { ?> <tr> <td><img src="<?php echo $this->crud_model->get_image_url('member', $row['member_id']); ?>" class="img-circle" width="40px" height="40px"></td> <td><?php echo $row['name'] ?></td> <td><?php echo $row['birthdate'] ?></td> <td><?php echo $row['gender'] ?></td> <td><?php echo $row['email'] ?></td> <td><?php echo $row['address'] ?></td> <td> <a onclick="showajaxmodal('<?php echo base_url(); ?>index.php?modal/popup/edit_member/<?php echo $row['member_id'] ?>');" class="btn btn-default btn-sm btn-icon icon-left"> <i class="entypo-pencil"></i> edit </a> <a href="<?php echo base_url(); ?>index.php?admin/member/delete/<?php echo $row['patient_id'] ?>" class="btn btn-danger btn-sm btn-icon icon-left" onclick="return checkdelete();"> <i class="entypo-cancel"></i> delete </a> </td> </tr> <?php } ?> </tbody> </table>
on controller this
$this->load->library('pagination'); $config['base_url'] = 'index.php?admin/member/'; $config['total_rows'] = 200; $config['per_page'] = 20; $this->pagination->initialize($config);
on view
<?php echo $this->pagination->create_links(); ?>
Comments
Post a Comment