|
分类的模式:
1
--11
--12
2
--21
--22
这是我写的MODEL
function Select_List(){
$this->db->select('id,fid,name');
$g_list = $this->db->get("new");
foreach($g_list as $v){
$this->db->where('fid',$v['id']);
$g_list = $this->db->get("new");
}
return $g_list;
}
这是我写的控制器
function index()
{
$date['title'] = "你好!";
$this->load->model('MClass_List');
$date['se'] = $this->MClass_List->Select_List();
$this->load->view('bolgview',$date);
//$this->output->cache(0.5);启用缓存
//$this->output->enable_profiler(TRUE);测评程序
}
这是我写的视图
<select name="select">
<?php foreach($se->result() as $val):?>
<option value="<?=$val->id?>"><?=$val->name?></option>
<?php foreach($val->result() as $v):?>
<option value="<?=$v->id?>"><?=$v->name?></option>
<?php endforeach;?>
<?php endforeach;?>
</select> |
|