ID: 19528 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: ODBC related Operating System: AIX (UNIX) PHP Version: 4.2.2 New Comment:
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... Previous Comments: ------------------------------------------------------------------------ [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
