The leading edge of scripting languages and Oracle Database brought to you by the Data Access Development team

  • php
    January 5, 2007

Duplicate Columns in "2 Day Plus PHP Developer Guide"

Christopher Jones
Senior Principal Product Manager

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.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.