|
数据库的表名:video_film
我在 model Test_m 中的代码:
public function test_select()
{
$query = $this->db->get('video_film');
return $query->result_array();
//$this->load->view('test_v',$query);
}
在 controller Test_c 中的代码
public function index()
{
$this->load->model('test_m');
$data = $this->test_m->test_select();
$this->load->view('test_v',$data);
}
在 view Test_v 中的代码:
<?php foreach ($video_film as $news_item): ?>
<?php echo $news_item['id']; ?>
<?php echo $news_item['name']; ?>
<?php endforeach; ?>
为什么总是提示:$video_film 未定义
???
正确的应该怎么写?
先谢谢了。
|
|