ID: 19528 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: ODBC related Operating System: AIX (UNIX) PHP Version: 4.2.2 New Comment:
I found one interesting observation when I write a short test script. It showed that if I use the odbc_fetch_row() only, it work fine. It showed that if I use the odbc_fetch_into() only, it work fine. It showed that if I use both the odbc_fetch_row() and odbc_fetch_into(), it showed a minor problem, that is not being able to display one row if there is only one row. But work fine when there's two rows or more. Previous Comments: ------------------------------------------------------------------------ [2002-09-23 08:41:14] [EMAIL PROTECTED] Forget the last comment I made, I typed down the wrong function, so use this comment instead of hte last comment. Should have read it once more time to make sure I don't overlook something. ----------------------------------------------------------- The webserver is made of IBM RS/6000, use IBM AIX and use IBM DB2 for database. The odbc_fetch_into() worked fine. To test it the functionality of the odbc_fetch_row(), I do the echo command followed by 'Result or No Result??? -->' then the odbc_fetch_row(). This tell me whether the result is returned in form of data or not. So, this showed the problem lie with odbc_fetch_row(). Because when there is two rows, it work okay and allow the odbc_fetch_into() to show two rows. When I delete one row, the odbc_fetch_row() saw one row and it does not allow the odbc_fetch_into() to show the one row. ------------------------------------------------------------------------ [2002-09-23 08:39:07] [EMAIL PROTECTED] The webserver is made of IBM RS/6000, use IBM AIX and use IBM DB2 for database. The odbc_fetch_into() worked fine. To test it the functionality of the odbc_fetch_row(), I do the echo command followed by 'Result or No Result??? -->' then the odbc_fetch_row(). This tell me whether the result is returned in form of data or not. So, this showed the problem lie with odbc_fetch_into(). Because when there is two rows, it work okay and allow the odbc_fetch_into() to show two rows. When I delete one row, the odbc_fetch_row() saw one row and it does not allow the odbc_fetch_into() to show the one row. ------------------------------------------------------------------------ [2002-09-22 20:00:43] [EMAIL PROTECTED] Considering the code in question hasn't changed since 4.0.5, I don't think this is a bug in PHP. Regardless what ODBC driver, and DB are you connecting to? And are you sure you're not refering to odbc_fetch_into? Because that prototype did change... ------------------------------------------------------------------------ [2002-09-20 12:38:29] [EMAIL PROTECTED] The odbc_fetch_row() function worked fine when I used PHP version 4.0.6 but when I upgraded PHP to 4.2.2, the odbc_fetch_row() doesn't work when there is 1 row. When I use the echo command to see the response to the odbc_fetch_row() before the while loop, it showed that it doesn't return True or anything when there is 1 row. I made the workaround to the problem by including the "$bug_workaround" into the script, this is to be use as 'row number' as shown in the PHP manual at "http://www.php.net/manual/en/function.odbc-fetch-row.php". I enclosed two clipping to point this out. The 1st clipping is the one that don't work and the 2nd clipping showed the work-around to it. In this script, you'll find the word, 'INQUIRIES', it is a table that contain number of companies and users. What the script does is to display each user whenever the company is selected. The cool thing about it is it won't display the data if there is no row for any user. --clip-- $cid = odbc_connect('blah blah blah'); $ask7 = "SELECT * FROM INQUIRIES WHERE USER_ID = '38SCK3'"; $R7 = odbc_exec($cid,$ask7); $result = odbc_result($R7,1); echo "Result or No Result??? --> ".odbc_fetch_row($R7); while (odbc_fetch_row($R7)) { odbc_fetch_into($R7,$inquiry,$inq_c); echo $inquiry[0], $inquiry[1]; } --clip-- --clip-- $cid = odbc_connect('blah blah blah'); $ask7 = "SELECT * FROM INQUIRIES WHERE USER_ID = '38SCK3'"; $R7 = odbc_exec($cid,$ask7); $result = odbc_result($R7,1); echo "Result or No Result??? --> ".odbc_fetch_row($R7); $bug_workaround=0; while (odbc_fetch_row($R7,++$bug_workaround)) { odbc_fetch_into($R7,$inquiry,$inq_c); echo $inquiry[0], $inquiry[1]; } --clip-- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19528&edit=1
