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?
