|
views里面是这么写的
<p>
<label>学生姓名: </label>
<select name="acid">
<?php foreach ($students_cats->result() as $students_cat) { ?>
<option value="<?php echo $students_cat->id ?>">
+<?php echo $students_cat->name ?>
</option>
<?php } ?>
</select>
<select name="acid">
<?php foreach ($students_cats->result() as $students_cat) { ?>
<option value="<?php echo $students_cat->id ?>">
+<?php echo $students_cat->name ?>
</option>
<?php foreach($this->common->categorys2($students_cat->id) as $c) { ?>
<option value="<?php echo $c->id ?>">
--<?php echo $c->name ?>
</option>
<?php } ?>
<?php } ?>
</select>
</p>
models里面是这么写的
public function categorys2($id) {
$this->CI->db->where("pid", $id);
$query = $this->CI->db->get('students_cat');
return $query->result();
}
我该什么改 好无助啊 求大神帮忙、 跪求 |
|