|
本帖最后由 jwgl 于 2011-7-14 20:17 编辑
下面是我写的一段代码
function record_score_course(){ //models
$query=$this->db->query("SELECT Cname FROM courses WHERE cno IN(SELECT cno FROM teach WHERE tno='01')");
return $query->result();
}
function record_score_stu(){ //教师成绩录入模型:学生信息
$cname=$this->input->post('course');
$query=$this->db->query("SELECT * FROM students WHERE sno IN(SELECT sno FROM select_course WHERE cno IN (SELECT cno FROM courses WHERE cname='$cname' AND tno='01'))");
return $query->result();
}
function index(){ //controllers
$this->load->model('mjwgl');
$data['course']=$this->mjwgl->record_score_course();
$data['stu_info']=$this->mjwgl->record_score_stu();
$this->load->view('record_score',$data);
}
<form action="#"> //views
<span>请选择录入课程:</span>
<select name="course">
<?php foreach ($course as $row): ?>
<option value="yss"><?= $row->Cname ?></option>
<?php endforeach;?>
</select>
</form>
在上述代码中,我想要实现的是当我在下拉式列表中选择课程为微积分时,在 下面的列表中要出现选择微积分课的学生信息,可是我的却显示不了。想要问一下为什么。
|
|