SolveErrors
PHP

Warning: oci_free_statement(): 3 is not a valid oci8 statement resource

66 views

Howdy.

Can someone tell me - does the oci_free_statement error out when there are no records?

Otherwise, can you tell me why I'd get the "oci_free_statement(): 3 is not a valid" error with this?

Code: [Select]
$connSelect = oci_connect($usr, $pwd, $db);

$sqlSelect =  "SELECT  a.myfield  FROM mytable ";

$stmt=oci_parse($connSelect,$sqlSelect);
oci_execute($stmt, OCI_DEFAULT);

while (($row = oci_fetch_array($stmt, OCI_BOTH))) {
$myfield =  $row[0];
}

$sqlSelect = null;
$row = null;
oci_free_statement($stmt);
oci_close($connSelect);

There are no errors in the SQL, and there are zero records returned. Can't I still free the statement if there are no records? or do I need to add an if statement to free it only when records > 0?

More PHP fixes

PHP-General - Header tag not directing to specified pageindex.php wont load index.html will loadHow to cut down the size of a URL?Page 2 - str_replacePHP-General - Variabses wont loadSyntax help - $random_name