如何使用codeigniter显示mysql数据透视表数据

I,m try to my table column data display in one single row... mysql query is work but i cant fetch data display

     function get_daily_attendances_row($fldCompanyStringID){

            $fldCompanyID = getCoompanyByStringID($fldCompanyStringID)->fldCompanyID;
$sql = "SELECT *

    , SUM(CASE WHEN `fldAttendanceAction` = '0' THEN `fldAttendanceTime` END) AS `OUT`
    , SUM(CASE WHEN `fldAttendanceAction` = '1' THEN `fldAttendanceTime` END) AS `IN`
    , SUM(CASE WHEN `fldAttendanceAction` = '2' THEN `fldAttendanceTime` END) AS `LUNCH IN`
    , SUM(CASE WHEN `fldAttendanceAction` = '3' THEN `fldAttendanceTime` END) AS `LUNCH OUT`
  FROM `tblAttendance`
  WHERE fldUserID = ". loggedInUserID() ." AND  fldCompanyID = $fldCompanyID
  GROUP BY `fldAttendanceDate`";
          $query = $this->db->query($sql);      

          $result = $query->result_array(); 

i want to display this value in my view table

this is my controller

$data['get_daily_attendances_row'] = $this->M_attendance->get_daily_attendances_row($fldCompanyStringID);
}

1个回答



我建议您将查询转换为mysql上的存储过程并从codeigniter执行SP。</ p>
< / DIV>

展开原文

原文

I suggest you that please convert the query to a stored procedure on mysql and execute the SP from codeigniter.

doucan9079
doucan9079 我不介意做什么。
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐