var_dump($ row);を使用する場合 私のコードでは、ウェブページにresource(29、mysql linkpersistent)と書かれた行が表示されます。これはどういう意味ですか?phpとcodeigniteは初めてなので、できればシンプルにしてください。ありがとうございます。
controller.php
<?php
class Survay extends CI_Controller{
function index()
{
$data = array(
'question' => $this->input->post('question'),
'answer1' => $this->input->post('answer1'),
'answer2' => $this->input->post('answer2'),
'answer3' => $this->input->post('answer3'),
'answer4' => $this->input->post('answer4'),
'answer5' => $this->input->post('answer5'),
'answer6' => $this->input->post('answer6'),
);
if($query = $this->membership_model->get_records()){
$data['records'] = $query;
}
$this->page();
$this->load->view('survay_view', $data);
}
//pagination
function page()
{
$this->load->library('pagination');
$config['base_url'] = 'http://localhost/admin/index.php/survay/';
$config['total_rows'] = $this->db->get('save_survay')->num_rows();
$config['per_page'] = 1;
$config['num_links'] =10;
$this->pagination->initialize($config);
//print_r($this->uri->segment());die;
$data['records'] = $this->db->get('save_survay', $config['per_page'],
$this->uri->segment(2,0));
$data['pagination'] = $this->pagination->create_links();
$this->load->view('survay_view', $data);
}
}
?>
view.php
</head>
<body>
<h1>Answer</h1>
<?php if (isset($records)) : foreach($records as $row) : ?>
<div = 'container'>
<ul>
<?php
if (isset($pagination))
{
echo $pagination;
}
?>
<h1><?php echo $row->question; ?></h1>
<li><?php echo $row->answer1; ?></li>
<li><?php echo $row->answer2; ?></li>
<li><?php echo $row->answer3; ?></li>
<li><?php echo $row->answer4; ?></li>
<li><?php echo $row->answer5; ?></li>
<li><?php echo $row->answer6; ?></li>
<ul>
</div>
<?php endforeach; ?>
<?php else : ?>
<h2>no records were returned</h2>
<?php endif; ?>
</body>
</html>