//model
public function test01_modela() {
$query = $this->db->query("SELECT id,name FROM test01");
return $query->result_array();
}
public function test02_modela($id) {
$query = $this->db->query("SELECT id,name FROM test02 WHERE id=$id");
return $query->result_array();
}
//controllers
public function test01_controllers()
{
$data['test01_controllers'] = $this->test_model->test01_model();
$this->load->view('test_view', $data);
}
public function test02_controllers($id)
{
$data['test02_controllers'] = $this->test_model->test02_model($id);
$this->load->view('test_view', $data);
}
//view
<?php
foreach($test01_controllers AS $row1)
{
echo $row1['name']; //印出商品
//怎么呼叫test02_controllers印出?
}
?>