Re: Bug #2688: OCIFetchInto only returns OCI_NUM when called from inside a function.

From: Date: Tue, 09 Nov 1999 08:39:57 +0000
Subject: Re: Bug #2688: OCIFetchInto only returns OCI_NUM when called from inside a function.
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-12234@lists.php.net to get a copy of this message
hi please download the 3.0.11 win32 binary from www.php.net and try that - please let me know if there's any difference! (i've just tried with PHP 3 and PHP 4 (lastest CVS)) and both show the expected behaviour! tc On 8 Nov 1999 tommy@webontap.com wrote: > From: tommy@webontap.com > Operating system: NT4 > PHP version: 3.0.12 > PHP Bug Type: Oracle related > Bug description: OCIFetchInto only returns OCI_NUM when called from inside a function. > > code below, works as expected: > /*--------------------------------------------------*/ > $query = "SELECT * FROM USERS"; > $conn = OCILogon("username", "passwd", "db"); > $stmt = OCIParse($conn, $query); > OCIExecute($stmt); > while (OCIFetchInto($stmt, &$row, OCI_ASSOC)) { > echo $row["LASTNAME"] . ", " . $row["FIRSTNAME"] . > "<br>"; > } > OCIFreeStatement($stmt); > OCILogoff($conn); > /*--------------------------------------------------*/ > HOWEVER... > > THIS code below, does not: > > /*--------------------------------------------------*/ > function getusers() { > $query = "SELECT * FROM USERS"; > $conn = OCILogon("username", "passwd", "db"); > $stmt = OCIParse($conn, $query); > OCIExecute($stmt); > while (OCIFetchInto($stmt, &$row, OCI_ASSOC)) { > echo $row["LASTNAME"] . ", " . $row["FIRSTNAME"] . > "<br>"; > } > OCIFreeStatement($stmt); > OCILogoff($conn); > } > /*--------------------------------------------------*/ > > After tearing my hair out for an hour, i tried THIS: > > /*--------------------------------------------------*/ > function getusers() { > $query = "SELECT * FROM USERS"; > $conn = OCILogon("username", "passwd", "db"); > $stmt = OCIParse($conn, $query); > OCIExecute($stmt); > while (OCIFetchInto($stmt, &$row, OCI_ASSOC)) { > echo $row[0] . ", " . $row[1] . "<br>"; > } > OCIFreeStatement($stmt); > OCILogoff($conn); > } > /*--------------------------------------------------*/ > > REGARDLESS of using OCI_ASSOC or OCI_NUM, the OCIFetchInto called from within the FUNCTION > returned an enumerative 0-based array into $row, whereas the OCIFetchInto called in the ordinary > code (using OCI_ASSOC) returned an associative array into $row. > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany

« previous php.dev (#12234) next »