2014-11-20 2 views
-2

그것은 오류를 보여주고있다 결과불법 문자열 오프셋 오류가

내 컨트롤러 파일 (client.php)에 있습니다.

public function viewlistdetail() 
{ 

     $id=base64_decode($_GET['id']); 
    $this->load->helper('client'); 
    $this->load->model('client/Client_model'); 
    $this->Client_model->viewlistdetail($id); 
} 

이 내가이 당신의 대답은 확실하지 않다 (client_model.php)

function viewlistdetail($st) 
{ 
    //echo $st;die; 
    $data['page_title'] = 'List View'; 
    $data['detail']=$this->getlistdetail($st); 

    $this->load->view('client/general/head',$data); 
    $this->load->view('client/general/header'); 
    $this->load->view('client/listview',$data); 
    $this->load->view('client/general/footer'); 
} 
     public function getlistdetail($id){ 

     // $this->db->reconnect(); 
     try{ 

      $query1 = $this->db->query("SELECT id,name,detail,facility,address,city FROM listing WHERE id='$id'"); 
      $str1=array(); 

     if ($query1->num_rows() > 0) 
     { 
      $j=0; 
      foreach ($query1->result() as $row1) 
       { 
       $str1=array("id"=>$row1->id,"name"=>$row1->name,"detail"=>$row1->detail,"facility"=>$row1->facility,"address"=>$row1->address); 

       $str1['photo']=$this->getphoto($id); 
       $str1['price']=$this->getprice($id); 
       $str1['tag']=$this->gettag($id); 
       $j++; 
       } 
     } 

     else 
     { 
      $str1="No record Found"; 

     } 
     } 
     catch (Exception $exd){ 
     $str1= "error"; 
     } 
     return $str1; 
    } 

파일보기 (listview.php)

<h4><?php echo var_dump($detail['name']);?></h4> 
    <span class="bussadd"><?php var_dump($detail['detail']);?><span> 
+2

W 모자는 CI에서 MVC를 사용합니다. 모델 클래스에서 뷰를 호출하고 있습니다! 왜 컨트롤러에서 전화하지? –

+0

배열을 게시 할 수 있습니까? var_dump ($ detail) –

답변

0

내 모델 파일에 있습니다. 제 대답으로 당신이 어떤 생각을하게 될 것 같아요.

는 모델 페이지에서 컨트롤러 client.php

public function viewlistdetail() 
{ 

     $id=base64_decode($_GET['id']); 
    $this->load->helper('client'); 
    $this->load->model('client/Client_model'); 

    $data['page_title'] = 'List View'; 
    $data['detail']=$this->Client_model->getlistdetail($id); 

    if(isset($data['detail'])) 
    { 
    $this->load->view('client/general/head',$data); 
    $this->load->view('client/general/header'); 
    $this->load->view('client/listview',$data); 
    $this->load->view('client/general/footer'); 
    } 
    else 
    die('No list to display'); 

} 

에 파일을 변경

client_model.php

public function getlistdetail($id){ 

    // $this->db->reconnect(); 
    try{ 

     $query1 = $this->db->query("SELECT id,name,detail,facility,address,city FROM listing WHERE id='$id'"); 
     $str1=array(); 

    if ($query1->num_rows() > 0) 
    { 
     $j=0; 
     foreach ($query1->result() as $row1) 
      { 
      $str1=array("id"=>$row1->id,"name"=>$row1->name,"detail"=>$row1->detail,"facility"=>$row1->facility,"address"=>$row1->address); 

      $str1['photo']=$this->getphoto($id); 
      $str1['price']=$this->getprice($id); 
      $str1['tag']=$this->gettag($id); 
      $j++; 
      } 
    } 

    else 
    { 
     $str1="No record Found"; 

    } 
    } 
    catch (Exception $exd){ 
    $str1= "error"; 
    } 
    return $str1; 
} 

로보기 파일

<h4><?php var_dump($detail['name']);?></h4> 
    <span class="bussadd"><?php var_dump($detail['detail']);?><span> 
+0

치명적인 오류 : 정의되지 않은 메소드를 호출합니다. 72 행의 D : \ xampp \ htdocs \ clubhouz \ application \ controllers \ client.php에있는 Client :: getlistdetail() 이 오류가 표시됩니다. –

+0

답변을 업데이트했습니다. 컨트롤러에서이 라인을 주석 처리 할 때 –

+0

을 확인하십시오. // $ data [ 'detail'] = $ this-> getlistdetail ($ st); 표시 할 목록이 없습니다. –

관련 문제