خرید بک لینک

Vote count: 0

My code is like this :

public function get_opportunity($group_id)
{
    $sql = "SELECT COUNT(transaction_id) AS total_transaction 
            FROM `transaction` 
            WHERE group_id IN(?)";

    $result = $this->db->query($sql, array($group_id))->result_array();

    retu ($result[0]['total_transaction']) ? $result[0]['total_transaction'] : 0;
}

For example, group_id = 1,2,3

If add echo $this->db->last_query();die();, The result :

SELECT COUNT(transaction_id) AS total_transaction 
FROM `transaction` 
WHERE group_id IN('1,2,3')

This is wrong

I want change the last query to be like this :

SELECT COUNT(transaction_id) AS total_transaction 
FROM `transaction` 
WHERE group_id IN(1,2,3)

Or like this :

SELECT COUNT(transaction_id) AS total_transaction 
FROM `transaction` 
WHERE group_id IN('1','2','3')

Any solution to solve my problem?

asked 26 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 6 مرداد 1395 ساعت: 15:25

صفحه بندی