The following function returns only the last row of an array:
function myFunc () {
$sql = mySql();
$stid = oci_parse(getConnect(),$sql);
// runs the query above
oci_execute($stid);
if (oci_execute($stid)) {
while ($row =oci_fetch_array($stid,OCI_ASSOC+OCI_RETURN_NULLS)) {
$out1 = "";
foreach($row as $column =>$entry)
$out1 .= $entry;
$output = $out1;
//var_dump($output); - here I can see all array elements
}
return($output);
}
else return "No Oracle connection";
}
var_dump()
shows all the array elements, but the function displays only the last row of the array. Is it because function's return? Do I have to return an array to get all array elements? How can I get all array elements in a one string?