2013-04-23 4 views
-2

컨트롤러 파일 : 여기에 기능 지수 여기페이지 매김 404 오류가

 public function index() 
     { 
     $this->load->helper('url'); 
     $this->load->helper('form'); 
     $this->load->model('register_model'); 
     $this->load->library("pagination"); 
     $config = array(); 
     $config["base_url"] = base_url()."register"; 
     $config["total_rows"] = $this->register_model->record_count(); 
     $config["per_page"] = 5; 
     $config["uri_segment"] = 3; 

     $this->pagination->initialize($config); 

     $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0; 
     $data["result"] = $this->register_model->fetch_logs($config["per_page"], $page); 
     $data["links"] = $this->pagination->create_links();    
     $this->load->view('register',$data);    
     } 

여기
 public function view() 
    { 
     $query = $this->db->query("select * from user_login"); 
     return $query->result_array(); 
     } 

    public function record_count() 
    { 
     return $this->db->count_all("user_login"); 
    } 

    public function fetch_logs($limit, $start) 
    { 
     $this->db->limit($limit, $start); 
     $query = $this->db->get("user_login"); 

     if ($query->num_rows() > 0) { 
      foreach ($query->result() as $row) { 
       $data[] = $row; 
      } 
      return $data; 
     } 
     return false; 
     } 

내보기 코드가 여기에

<form method="post" accept-charset="utf-8" action="<?php echo base_url(); ?>/register/create" class="myform" id="myform" /> 

    <div style="text-align:left;"><h1>User Registration</h1></div> 
     <table width="488" border="0"> 
      <tr> 
      <td colspan="3">User 
       <input name="user_name" type="text" size="40" /></td> 
      </tr> 
      <tr> 
      <td colspan="3">Pass 
       <input name="password" type="password" size="40" /></td> 
      </tr> 
      <tr> 
      <td width="278" align="right"><input name="submit" type="submit" value="ADD" class="big_btn"/></td> 
      <td width="148" align="center">&nbsp;</td> 
      <td width="48" align="center">&nbsp;</td> 
      </tr> 
     </table> 
     <p>&nbsp;</p> 
      <table width="679" border="1" cellpadding="3" cellspacing="0"> 

     <tr><th width="202" align="center">User</th>  
      <th width="319" align="center">Password</th> 
      <th colspan="2" align="center">Action</th> 
     <?php 
     foreach ($result as $row) 
     { 
     ?> 
     <tr> 
     <td height="32" align="center"><?php echo $row->user;?> </td> 
     <td align="center"><?php echo md5($row->pwd);?></td> 
     <td width="56" align="center"><a href="<?php echo base_url();?>/register/delete/<?php echo $row->id;?>"> 
     <input name="delete" type="button" id="delete" value="x" class="del_btn"> 

     </a></td> 
     <td width="68" align="center"><?php 
    $atts = array(
        'width'  => '700', 
        'height'  => '300', 
        'scrollbars' => 'no', 
        'status'  => 'no', 
        'resizable' => 'yes', 
        'screenx' => '600', 
        'screeny' => '150' 
       ); 
    echo anchor_popup(base_url().'/register/viewmore/'.$row->id, '<input name="view" type="button" id="view" value="" class="view_btn">', $atts); 
    ?></td> 
     </tr> 
    <?php 
     } 

     ?> 

     </table> 

    </form> 
    </div> <p><?php echo $links; ?></p> 

내가 볼 수있는이야 내 모델 함수이야 페이지 매김 링크하지만 링크를 클릭 한 후 404 페이지를 찾을 수 없음 오류 어느 누구도 이것을 확인하고 회신 할 수 있습니까 ??

+0

두 번째 페이지의 URL은 무엇입니까 ?? –

답변

0

당신의 위의 컨트롤러는 컨트롤러를 등록 할 경우 변경이

$config["base_url"] = base_url('register'); // or you can use site_url('register'); 
+0

나는 두가지 방법을 시도했다. $ config [ "base_url"] = site_url ('index') && $ config [ "base_url"] = base_url ('index'); 하지만 같은 오류 – Roy

+0

그래서 페이지를 클릭 한 후 URL은 무엇입니까 ?? – Gautam3164

0

$config["base_url"] = base_url()."register"; 

는 다음을 수행 할 수 있습니다

$config["base_url"] = site_url("register"); //this will call the index function of register contoller 
나는 문제가 시도되고 여기에 생각
0
public function index() { 
    $this->load->helper ('url'); 
    $this->load->helper ('form'); 
    $this->load->model ('register_model'); 
    $this->load->library ("pagination"); 
    $config = array(); 
    $config ["base_url"] = base_url ('register/index/'); 
    $config ["total_rows"] = $this->register_model->record_count(); 
    $config ["per_page"] = 5; 
    $config ["uri_segment"] = 3; 
    $this->pagination->initialize ($config); 
    $page = ($this->uri->segment (3)) ? $this->uri->segment (3) : 0; 
    $data ["result"] = $this->register_model->fetch_logs ($config ["per_page"], $page); 
    $data ["links"] = $this->pagination->create_links(); 
    $this->load->view ('register', $data); 
} 
0

이 like

$config['base_url'] = site_url('register/index/');