|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-08-31 08:55 UTC] kara@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 03:00:01 2025 UTC |
The problem is that if you loop through a query using odbc_fetch_row, the internal row pointer will get stuck on whatever the highest row index was. In the following script, the first three records are printed correctly. In the second loop, the last record is printed three times. <?php //Here we will demonstrate the problem. $db = odbc_exec(odbc_connect("testodbc","system","manager"), "select * from Table1"); for ($i=1; $i<=3; $i++) { odbc_fetch_row($db, $i); for ($j=1; $j<=3; $j++) { echo odbc_result($db, $j) . "<BR>"; } } //The above works OK. Now, let's try to reset the pointer: odbc_fetch_row($db, 1); //<<<THIS IS WHERE THE PROBLEM IS>>>// //And let's go again: for ($i=1; $i<=3; $i++) { odbc_fetch_row($db, $i); for ($j=1; $j<=3; $j++) { echo odbc_result($db, $j) . "<BR>"; } } //The row pointer is stuck on the last record. ?> I am using PHP-4.0.2 with the appropriate Zend Optimiser. I have made no changes to the supplied php.ini (optimised) other than adding an include path and enabling the optimiser. I am using NT4sp6 and Oracle 8i Personal. Thanks :)