smeagolgollum
Programmer
Hi
i am having a lot of trouble with one of my scripts
i encapsulated the execution of select statement and their output to the browser in a class.
all it does is connect to the database using user/pass/db given, executes the statement and builds a table from it.
my problem is that when php frees the statement ressource (either with ocifreestatement or when the script finishes)
below is the code that executes the sql statement
when building the table i only use ocifetchinto to retrieve the rows
the really weird thing is that the class works with every other scripts but it won't with that one that uses two instances of the class.
-------------------------------------------------------
i am having a lot of trouble with one of my scripts
i encapsulated the execution of select statement and their output to the browser in a class.
all it does is connect to the database using user/pass/db given, executes the statement and builds a table from it.
my problem is that when php frees the statement ressource (either with ocifreestatement or when the script finishes)
below is the code that executes the sql statement
when building the table i only use ocifetchinto to retrieve the rows
the really weird thing is that the class works with every other scripts but it won't with that one that uses two instances of the class.
-------------------------------------------------------
Code:
// pour eviter les plantages de PHP, on fait une copie locale des variables passées à OCI
$user = $this->ora_user;
$pass = $this->ora_pass;
$base = $this->ora_base;
$bind_vars = $this->bind_vars;
$conn = OCIPLogon($user,$pass,$base);
if (! $conn) return false;
$stmt = OCIParse($conn,$sql);
if (! $stmt) return false;
foreach($bind_vars as $bind_var => $var)
if (!OCIBindByName($stmt,$bind_var,$bind_vars[$bind_var],-1)) return false;
if (! OCIExecute($stmt)) return false;
$num_cols = OCINumCols($stmt);
$this->colnames = array();
for ($i = 1; $i <= $num_cols; $i++)
{
$colname = OCIColumnName($stmt,$i);
if (! preg_match("/\{hidden\}/i",$colname))
$this->colnames[] = $colname;
}
// finished connecting, parsing and executing