From: [EMAIL PROTECTED] Operating system: AIX (UNIX) PHP version: 4.2.2 PHP Bug Type: ODBC related Bug description: odbc_function_row() doesn't returned true if there is one row only
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 bug report at http://bugs.php.net/?id=19528&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19528&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19528&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19528&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19528&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19528&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19528&r=support Expected behavior: http://bugs.php.net/fix.php?id=19528&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19528&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19528&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19528&r=globals