Here is my problem. I have a function that connects/logs on to oracle, retrieves all data into an array and then disconnects/logs off from oracle. The problem, it is not disconnecting to oracle, when I view the processes of the database from the webserver, it shows several connections still. Can anyone shed some light for me on how to ensure the functions logs off from oracle properly.
Here is the function:
//Database Get Results Functions (Oracle)
function ORAResults($query, $start, $max) {
$DBS = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521)))(CONNECT_DATA = (SID = dbserver) ) )";
$OConn = OCIPLogon("user", "password", $DBS) or die ("Bad Login");
$query = stripslashes($query);
$Statement = OCIParse($OConn, $query) or die("ERROR 1:<br><br>Query:<br>" . $query);
OCIExecute($Statement) or die("ERROR 2:<br><br>Query:<br>" . $query);
$nrows=OCIFetchStatement($Statement, $Results, $start, $max);
if ($nrows>0) {
$ncols = OCINumCols($Statement);
$x=0;
$output=array();
for ($r=0; $r<$nrows; $r++) {
for ($c=1; $c<=$ncols; $c++) {
$field=strtoupper(OCIColumnName($Statement,$c));
$var2store = $Results[$field][$r];
$output[$r][$field]=$var2store;
};
};
//Return array results
OCICancel($Statement);
OCIFreeStatement($Statement);
OCILogOff($OConn);
return $output;
} else {
OCICancel($Statement);
OCIFreeStatement($Statement);
OCILogOff($OConn);
return 0;
};
};