用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2107|回复: 0
收起左侧

[已解决] 求教

[复制链接]
发表于 2013-3-31 14:57:11 | 显示全部楼层 |阅读模式
本帖最后由 ntdba 于 2013-3-31 19:56 编辑

分页为什么没有显示啊?

控制器:
          function user_edit() {
               $this->load->library('pagination');
               $config['base_url'] = base_url().'index.php/user/user_edit/';   
               $config['total_rows'] = $this->db->count_all('user');
               $config['per_page'] = '2';
               $config['full_tag_open'] = '<p>';
               $config['full_tag_close'] = '</p>';
               $this->pagination->initialize($config);
               $this->load->model('user_m');
               $data['query']=$this->user_m->user_edit();
               $this->load->view('user_edit',$data);
    }   
模型:
         function user_edit()          {
                $this->db->select('*');
                $this->db->from('user');
                $query = $this->db->get();
                return $query;
          }

视图:
<?php $this->load->helper('url');?>
<base href="<?php echo base_url();?>" />
<table width="70%" border="0" cellspacing="0" cellpadding="0">
<tr>    <td align="center" valign="middle">员工信息 </td>  </tr>
</table>
<table width="70%" border="0" cellspacing="0" cellpadding="0">
<tr>    <td>工号</td>    <td>姓名</td>    <td>出生年月</td>    <td>性别</td>    <td>学历</td>    <td>电话</td>    <td>身份证</td>    <td>家庭住址</td>    <td>操作</td>  </tr>
<?php foreach($query->result() as $row):?>
   <tr>    <td><?php echo $row->user_id; ?></td>
               <td><?php echo $row->name; ?></td>
              <td><?php echo $row->birthday;?></td>
              <td><?php echo $row->sex;?></td>
             <td><?php echo $row->xueli;?></td>
             <td><?php echo $row->mobile;?></td>   
<td><?php echo $row->card;?></td>  
  <td><?php echo $row->add_home;?></td>  
  <td><?php echo "编辑";?></td>    </tr>  
  <tr>    <?php echo $this->pagination->create_links(); ?>    </tr>
<?php endforeach;?>

本版积分规则