|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27557 DB2 odbc_fetch_row with single row returns invalid result
Submitted: 2004-03-10 19:16 UTC Modified: 2004-03-16 11:59 UTC
From: admin at db-hq dot net Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 4.3.4 OS: Linux - Fedora Core 1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
46 + 30 = ?
Subscribe to this entry?

 [2004-03-10 19:16 UTC] admin at db-hq dot net
I am working on porting phpbb over to DB2, and ran into an error with odbc_fetch_row. When the following SQL is executed:

?SELECT * FROM phpbb_fourms WHERE forum_id = 1?

odbc_fetch_row($result_id, $i) returns false. Where i = 1.

Sending the query to the database returns one row. When I remove the $i from odbc_fetch_row it works perfectly. Also if more than one result is returned there is no problem. Also it seems to only occur when there is a select * or when there is a large number of columns returning a single row. 

I am pretty sure I have experienced this bug since the early 4.0.* days.

Reproduce code:
$i =  1;
$k = 0;
while(odbc_fetch_row($result_id, $i) && $k < $this->result_numrows[$result_id]){

for($j = 1; $j < count($this->result_field_names[$result_id])+1; $j++){

$this->result_rowset[$result_id][$k][$this->result_field_names[$result_id][$j-1]] = odbc_result($result_id, $j);


Expected result:
Expected odbc_fetch_row($result_id, $i) to return true.

Actual result:
odbc_fetch_row($result_id, $i) returned false if just one row was selected from the database. If more than one row was selected it returned true and worked fine.

Removing the $i from odbc_fetch_row() fixed the problem. None the less it is still appears a bug. I also verified that the database query does return one result.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-16 11:59 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Jun 09 12:03:39 2023 UTC