Hey guys im trying to get some data from a query (oracle) to pass into a varaible that i can use later in different fuctions/queries . can someone help me fix my code?
$conn = oci_connect('asdasddasddasd');
$RCB = array();
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, " SELECT WR.REQST_NO
FROM P_D.WORK_REQST WR
WHERE WR.WORK_REQST_STATUS_CD = 'PLAN' AND WR.DEPT_CD ='ISNG'
");
oci_execute($stid);
while (($row = oci_fetch_array($stid, OCI_BOTH+OCI_RETURN_NULLS)) != false) {
// Use the uppercase column names for the associative array indices
$GLOBAL['RCB'] = $row['REQST_NO'];
}
print_r($RCB);
oci_free_statement($stid);
oci_close($conn);
how come this doesn't work?
$GLOBALSwith anS... and you overwrite it each time, so just append a new row$GLOBALS['RCB'][] = $row['REQST_NO'];