如何从同一个表中的两列中获取值
问题描述:
我有一张表有student_id(Pk)和两列class_id和class_id2作为学生的学生可以在两个类中注册 我想使用代码点火器同时获得列的值和我尝试阵列,但它似乎没有工作,因为它得到所有学生如何从同一个表中的两列中获取值
<?php
$students = $this->db->get_where('student' , array('class_id'=>$class_id))->result_array();
foreach($students as $row):?>
<tr class="gradeA">
<td><?php echo $row['roll'];?></td>
<td><?php echo $row['name'];?></td>
<?php
当我的值更改为class_id2它从该列中的值,但我不知道如果有一种方法我可以得到两个?
你想获得通过,它包含两个class_1和class_2条件where子句的数据。我对吗? –