« January 4, 2007 | Main | January 18, 2007 »

January 5, 2007 Archives

January 5, 2007

Duplicate Columns in "2 Day Plus PHP Developer Guide"

A post on the OTN forum reminded me of a documentation problem in the comprehensively titled Oracle Database Express Edition 2 Day Plus PHP Developer Guide 10g Release 2 (10.2) Part Number B25317-01

In chapter three "Connecting to the Database" at step 5 of you will get duplicate columns returned if you use the latest version of PHP.

The solution is to change the fetch line, adding "OCI_ASSOC+", to read:

       while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {

The change isn't necessary in older versions of PHP.

I have to admit I was involved in both ends of the problem: I wrote the PHP code for the manual and then I logged PHP bug 37487 which changed the default behavior of oci_fetch_array().

At the moment I'm having a similar discussion with Tony Dovgal, the lead maintainer of the oci8 extension, about PHP bug 39988.  We both believe the fix will have little or no impact but there is always doubt.  I'm in favor of making the change since there are some code examples that are harder to manage unless you can specify the return type of the data.

About January 2007

This page contains all entries posted to PHP and Oracle: Christopher Jones in January 2007. They are listed from oldest to newest.

January 4, 2007 is the previous archive.

January 18, 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle