ID: 10843
Updated by: kalowsky
Reported By: [EMAIL PROTECTED]
Old-Status: Feedback
Status: Open
Bug Type: ODBC related
Operating system: 
PHP Version: 4.0.5
Assigned To: 
Comments:

comment from user:

That patch is all Greek to me. I will have to find a 
compiler and learn how to
compile. Is there any chance of putting it in the 
updates at php4win or www.zend.com/snapshots

php4win posted an update 4.0.7 2001-06-11 so I tested that 
and still same
problem. 4.0.7 produced a strange result. The 
code:
while($result_all = odbc_fetch_into($result, 0, $array))
produces:
Fatal error: Only variables can be passed by reference

The following works:
$zero = 0;
while($result_all = odbc_fetch_into($result, $zero, 
$array))

$zero remains at 0 so is not updated.

Previous Comments:
---------------------------------------------------------------------------

[2001-06-11 11:03:57] [EMAIL PROTECTED]
can you please try this patch with a current build of PHP?

Index: php_odbc.c
===================================================================
RCS file: /repository/php4/ext/odbc/php_odbc.c,v
retrieving revision 1.92
diff -u -r1.92 php_odbc.c
--- php_odbc.c  11 Jun 2001 01:00:43 -0000      1.92
+++ php_odbc.c  11 Jun 2001 15:04:36 -0000
@@ -1489,6 +1489,9 @@
                }
                zend_hash_index_update((*pv_res_arr)->value.ht, i, &tmp, sizeof(pval 
*), NULL);
        }
+
+       zend_hash_internal_pointer_reset((*pv_res_arr)->value.ht);
+
        if (buf) efree(buf);
        RETURN_LONG(result->numcols);
 }


---------------------------------------------------------------------------

[2001-06-01 13:48:32] [EMAIL PROTECTED]
The database happened to be Access. I have MySQL and PostgeSQL available through ODBC 
and MySQL direct. I though the action to odbc_fetch_into() would be the same no matter 
which database.

Normally when a function returns an array, the pointer is at the start. Perhaps this 
is the result of passing an array by reference and what is needed is a documentation 
change to highlight what happens to the pointer.

---------------------------------------------------------------------------

[2001-06-01 11:57:16] [EMAIL PROTECTED]
what database is this with?

---------------------------------------------------------------------------

[2001-05-13 23:03:45] [EMAIL PROTECTED]
I tried odbc_fetch_into() in the enclosed loop. I had to inset the reset($array) to 
get the loop working. I figure the function is creating new content in the array but 
not resetting the array pointer back to the beginning. The function should either
1/ add to the end of the array and increment the pointer
or
2/ replace the contents and reset the pointer.

$sql = "select * from stock";
$result = odbc_exec($connection["vitamins"], $sql);
if($result)
   {
   print("<br>Result from odbc_fetch_into()" );
   $array = "";
   while($result_all = odbc_fetch_into($result, 0, $array))
      {
      reset($array);
      print("<br>" );
      while(list($k, $v) = each($array))
         {
         print($v . "&nbsp;&nbsp;");
         }
      }
   }
else
   {
   print("<br>No result" );
   }


---------------------------------------------------------------------------



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10843&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to