0
 function countSv_AV_total(){

    $this->db->flush_cache();
    $this->db->start_cache();

   $sql = "select Verzekeringen.naam,\n"
    . " count(*) total,\n"
    . " sum(case when (Age <= 18) then 1 else 0 end) Age18,\n"
    . " sum(case when (Age BETWEEN 19 AND 30) then 1 else 0 end) Age19,\n"
    . " sum(case when (Age BETWEEN 31 AND 50) then 1 else 0 end) Age30,\n"
    . " sum(case when (Age BETWEEN 51 AND 69) then 1 else 0 end) Age50,\n"
    . " sum(case when (Age >= 70) then 1 else 0 end) Age70\n"
    . " from customers\n"
    . " INNER JOIN Verzekeringen\n"
    . " ON customers.AV=Verzekeringen.verzekeringcode\n"
    . " AND Label =1\n"
    . " group by Verzekeringen.naam LIMIT 0, 30 ";

$this->db->query($sql);

    echo $this->db->last_query().'<br />';

    return $this->db->count_all_results('customers','Verzekeringen');
    $this->db->flush_cache();

}

我正在使用这个 SQL,并且在 Mysql 工作台中它给出了正确的输出。现在我希望它能够将它传递给 codeigniter Table 类。

当 foreach 未接收数据时出现错误:

遇到 PHP 错误

严重性:警告

消息:为 foreach() 提供的参数无效

文件名:views/welcome_message.php

行号:178

有人可以提供解决方案。提前致谢

4

0 回答 0