找不到404页面我的网址(easydelivery / dashboard / user / 3)

时间:2017-11-18 10:37:57

标签: php mysql pagination

class User extends CI_Controller {

    public function index(){ //        $this->db->join('comments', 'comments.id = blogs.id');
         $this->load->model('users');
         $data['base_url'] = base_url() .'dashboard/user/';
         $data['total_rows'] = $this->db->get('tbl_cpanel_user')->num_rows();
         $data['per_page'] = 3;
         $this->pagination->initialize($data); //        $data['pagination'] = $this->pagination->create_links();
         $data['results'] = $this->users->pagination($data['per_page'], $this->uri->segment(3));
         $this->load->view('dashboard/user',$data);

    }
}

这是我的模特

defined('BASEPATH') OR exit('No direct script access allowed');
class Users extends CI_Model {

    //pagination functions
    public function pagination($limit, $offset){
         $this->db->select('tbl_cpanel_user.Name, tbl_cpanel_user.Email, tbl_cpanel_user.ContactNumber,
 tbl_cpanel_user.Address,tbl_cpanel_user.UserId,tbl_cpanel_area.AreaId,tbl_cpanel_area.Area');
         $this->db->from('tbl_cpanel_user');
         $this->db->join('tbl_cpanel_area', 'tbl_cpanel_user.AreaId = tbl_cpanel_area.AreaId');
         $this->db->limit($limit, $offset);
         $query = $this->db->get();enter code here
         if($query == true){
             return $query->result();
         }else{
             return false;
         }
     }

这是视图页面

<div class="row">
    <div class="col-md-2 col-lg-2 hidden-xs hidden-sm menubar">

        <?php include_once ('menusidebar.php');?>
    </div> <!--menubar-->
    <div class="col-md-10 col-lg-10 col-xs-12 col-sm-12 homepage">
        <h2>All Users</h2>
        <hr>
        <table class="table table-striped">
            <tr>
                <th>SL.</th>
                <th>Name</th>
                <th>E-mail</th>
                <th>Contac</th>
                <th>Address</th>
                <th>Area</th>
                <th>Oparations</th>
            </tr>
            <?php $key = 1;
            foreach ($results as $result): ?>
            <tr>
                <td><?php echo $key++; ?></td>
                <td><?php echo $result->Name; ?></td>
                <td><?php echo $result->Email; ?></td>
                <td><?php echo $result->ContactNumber; ?></td>
                <td><?php echo $result->Address; ?></td>
                <td><?php echo $result->Area;  ?></td>
                <td><a href="<?php echo base_url().'dashboard/user/update/'.$result->UserId; ?>" class="btn btn-warning" title="<?php echo $result->Name; ?>">Edit</a></td>
            </tr>
            <?php endforeach; ?>
        </table>

        <?php
       echo $this->pagination->create_links(); ?>

    </div> <!--homepage-->

</div>

0 个答案:

没有答案