douxingsuo8809 2015-10-26 17:51
浏览 12


I have a table Students which has student_id (Pk) and two columns class_id and class_id2 as a student can be registered in two classes i would like to use Code-igniter to get the values of both columns and i tried arrays but it doesn't seem to work as it gets all students

   $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>

when i change the value to class_id2 it gets the values from that column but i don't know if there is a way i can get both?

  • 写回答

1条回答 默认 最新

  • dongyanpai2701 2015-10-26 18:04

    try this,

    $students   =   $this->db->get('student')->result_array();
    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥50 STM32L431RCT6 定时器2中断发起ADC 采样问题
  • ¥15 如何通过交互分析得出某高危患者对放疗获益更多
  • ¥15 相关性分析中,p<0.05, r=0.29,怎么评价相关性呢
  • ¥15 docker部署Mongodb后输入命令报错?
  • ¥15 将下列流程图转变成python程序代码
  • ¥15 我需要全国每个城市的最新小区名字等数据。
  • ¥15 开发一个小区生态的小程序
  • ¥15 如何解决Excel中dependent dropdown list 的问题
  • ¥15 MddBootstrapInitialize2失败
  • ¥15 LCD Flicker