大家好我有问题请帮帮我
我有两个表格主题,其他是问题
主题表中的字段是
+------+-----------+-----------+
| id | name | set_id |
+------+-----------+-----------+
问题表中的
+------+-----------+-----------+-----------+---------------+
| id |question | answer | subject |
+------+-----------+-----------+-----------+---------------+
我想显示如下图片的详细信息
如何做到这一点,请帮助我,你的帮助将不胜感激。
答案 0 :(得分:0)
function subjectlist(){
$val=array('a.id','a.name','a.set_id','b.set_name');
$where=array('user_id'=>$this->session->userdata['logged_in']['id']);
$sub=$this->login->get_join($val,'','b.id=a.set_id',$where,'subject as a','q_set as b');
$count_all=array();
foreach($sub as $count) {
$where1=array('subject_id'=>$count->id);
$count_all[]=array('id'=>$count->id,'name'=>$count->name,'set_id'=>$count->set_id,'set_name'=>$count->set_name,'all_val'=>$this->login->count_val($where1,'question'));
}
$data['subject']=$count_all;
$this->load->view('i_user/subject_list',$data);
}