arnold_p
arnold_p

Reputation: 505

Failed to Get Data Filtered by Date

I am trying to get data filtered by date but it shows me error that some of my variables are not defined. I already checked $filterDate has right values when I clicked it

I have function in Model: 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
    ");
}

How can I fix this thing? Thanks before

Upvotes: 0

Views: 35

Answers (1)

Vladimir
Vladimir

Reputation: 1391

Instead line

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

insern

WHERE tr_odp_fund.latest_date = '{$filDate}'

Upvotes: 1

Related Questions