CI 묻고 답하기

제목 배열이 안받아 집니다.도와주세요.ㅜㅜ
글쓴이 토리 작성시각 2010/04/08 20:54:35
댓글 : 1 추천 : 0 스크랩 : 0 조회수 : 22453   RSS

Controller에서 select결과(result) 와 1이라는 값을 배열에 담아 View단으로 넘기고..

view에서는 1이라는 값과 select 결과를 foreach 을 통해서 출력하고 싶습니다.

아래처럼 하면

Undefined variable: hashmap 라는 Error 가 나면서 작동이 안됩니다.ㅜㅜ

=======================================================================
[board.php] - Controller
=======================================================================
function blist($success) 
 {
  
  $this->load->model('Board_model'); // 모델 - 호출
  $arr_rs['rs']=$this->Board_model->select(); //리스트 가져오기 
  
  $hashmap = array('arr_rs' => $arr_rs, 'success'=>$success);

  $this->load->view('board_list', $hashmap); // 뷰 - 출력
  
 }
 
=======================================================================
[board_list.php] - View
=======================================================================
<?
   $success = $hashmap['success'];
   $arr_rs = $hashmap['arr_rs'];

   
  echo $success ;
?>

<?php foreach ($arr_rs as $row): ?>
    <tr>
        <td  height="36" bgcolor="white" width="45">
            <p align="center"><?=$row->no?></p>
        </td>
        <td  height="36" bgcolor="white" width="124">
            <p align="center"><?=$row->id?></p>
        </td>
      </tr>
<?php endforeach;?>

 다음글 php session과 ci내에서의 session공유방... (2)
 이전글 php session 질문 (1)

댓글

케이든 / 2010/04/09 01:42:45 / 추천 0
http://codeigniter-kr.org/user_guide/general/views.html

뷰에 파란부분 삭제하세요