ID: 38784 Updated by: [EMAIL PROTECTED] Reported By: keagle at westar dot com -Status: Open +Status: Bogus Bug Type: ODBC related Operating System: Windows XP PHP Version: 4.4.4 New Comment:
Use odbc_errormsg() to get the reson why it fails. Previous Comments: ------------------------------------------------------------------------ [2006-09-12 14:59:34] keagle at westar dot com By stating that the row number is "1-based", do you mean that rows are indexed (1 .. last)? If so, this doesn't help answer my question. The call returns false(0) regardless of the parameters passed into the call (1 or 0). Why is it that I can't get a positive value returned out of this call? It doesn't make sense. odbc_fatch_row($res) always returns a negative value and odbc_result won't return anything I can use. ------------------------------------------------------------------------ [2006-09-12 13:40:06] jkeagle at knology dot net Could you be more specific? ------------------------------------------------------------------------ [2006-09-12 09:33:00] [EMAIL PROTECTED] >odbc_fetch_row($res, 0) The row number is 1-based. ------------------------------------------------------------------------ [2006-09-11 21:51:31] jkeagle at knology dot net Note: num_rows & num_fields were output and return valid numbers. ------------------------------------------------------------------------ [2006-09-11 21:48:14] keagle at westar dot com Description: ------------ I'm having a problem getting 'odbc_fetch_row' to return true. Therefore, I am unable to fetch each row of my table. Is there something I'm leaving out in my code? I've tried everything I can think of. Please help. Thank you. Reproduce code: --------------- $sql = "SELECT PARAMETER_ID, DESCRIPTION from MDR_PARAM"; $res = odbc_exec($conn, $sql); $num_rows = odbc_num_rows($res); $num_fields = odbc_num_fields($res); $parameter_counter = 0; if(odbc_fetch_row($res, 0)) echo("odbc_fetch_row: SUCCESS ...\n\n"); else echo("odbc_fetch_row: FAILURE ...\n\n"); while(odbc_fetch_row($res)) { $param_id = odbc_result($res, "PARAMETER_ID"); $description = odbc_result($res, "DESCRIPTION"); $mdr_parameters[$description] = $param_id; $parameter_counter++; } $r = odbc_free_result($res); Expected result: ---------------- I would have expected "SUCCESS" to be output as opposed the "FAILURE" following the 'if' statement. And, I would have expected to fall into the 'while' loop, but to no avail. Actual result: -------------- odbc_fetch_row: FAILURE ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38784&edit=1