The SQL I'm trying to use in my PHP script is as follows:
SELECT my_id
FROM my_table
WHERE my_id IN ('id1', 'id2', 'id3');
As you can see, it's nothing too complex.
Here's my entire PHP with the above SQL in it:
$search_string = array('id1', 'id2', 'id3');
$placeholders = array();
$bind = array();
$conn = oci_connect('admin', '1234', 'testdb.mydomain.com/TEST');
foreach($search_string as $index => $filter) {
$placeholders[] = ':filter'.$index;
$bind[':filter'.$index] = $filter;
}
$stid = '
SELECT my_id
FROM my_table
WHERE my_id IN ('.implode(',',$placeholders).')
';
$stid = oci_parse($conn,$stid);
foreach($bind as $k=>$v){
oci_bind_by_name($stid, $k, $v);
}
$r = oci_execute($stid);
oci_fetch_all($stid, $res, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
print '<pre>';
var_dump($res);
print '</pre>';
oci_free_statement($stid);
oci_close($conn)
Again, nothing too complex. My problem is that the above PHP retrieves only 1 record when 3 are apparent in the database using the *EXACT* same SQL.
What might be causing this issue? Is there maybe something associated with Oracle configurations that prevent the entire result from being obtained in the PHP execution?
Any insights would be appreciated. Thanks in advance.