无法按日期过滤数据

时间:2018-01-23 08:07:13

标签: php codeigniter

我正在尝试按日期过滤数据,但它显示我的一些变量未定义的错误。我点击它时已经检查$filterDate有正确的值

我在模型中有函数:M_progressData.php

public function getSum($filDate)
{
    return $this->db->query("
        SELECT  tr_odp_fund.witel, tr_odp_fund.latest_date, tr_odp_fund.jumlah_uang, COUNT(tx_raw_data.labc_consumerid) as jumlah_odp
        FROM    tr_odp_fund
                INNER JOIN tx_raw_data
                    ON tx_raw_data.witel = tr_odp_fund.witel
                INNER JOIN
                (
                    SELECT  witel, MAX(latest_date) AS latest_date
                    FROM    tr_odp_fund
                    GROUP BY witel
                ) c
                    ON c.witel = tr_odp_fund.witel
                        AND c.latest_date =  tr_odp_fund.latest_date
        WHERE tr_odp_fund.latest_date = '<?php echo $filDate; ?>'
        GROUP BY tr_odp_fund.witel
    ");
}

我该如何解决这个问题?先谢谢

1 个答案:

答案 0 :(得分:1)

代替行

WHERE tr_odp_fund.latest_date = '<?php echo $filDate; ?>'

insern

WHERE tr_odp_fund.latest_date = '{$filDate}'