The array should be filled with [], i.e. instead of $items = , you should write $items[] =
$s= $data['s']; $s= explode(",",$s); $items = array(); foreach($s $row) { $items[] = $this->db->query("SELECT * FROM test WHERE id='{$row}'"); }
However, it is better not to execute queries in cycles. The most reasonable thing is to collect $row values into the $items array, and then use the IN keyword
SELECT * FROM test WHERE id IN (1, 5, 6, 8)
You can combine the values from $items into a string for IN using the implode() function