This is my function so far, how do I convert the item to json and print it?
$query = 'SELECT * FROM department';
function dataGenerator($query) {
$conn = oci_new_connect('u','p','h') or die ("dbdn");
$stid = oci_parse($conn, $query);
$r = oci_execute($stid);
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
foreach ($row as $item) {
print ($item); }
}
}
dataGenerator("SELECT * FROM department");
json_encode?print (json_encode($item));