ID: 12263 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: ODBC related Operating System: Windows 2000 PHP Version: 4.0.6 New Comment:
Thank you for taking the time to report a problem with PHP. Unfortunately your version of PHP is too old -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. Previous Comments: ------------------------------------------------------------------------ [2001-07-19 14:27:37] [EMAIL PROTECTED] I am trying to get the table names from an Access database using odbc_tables() and then using odbc_fetch_row() and odbc_result(). I can print all the results using odbc_result_all() which gives an html table with all the information (In my test database I get 8 rows). However when I try to go through the results using fetch_row() and odbc_result() I get errors. I've tried going through step by step and weird things are happening. This works: <? $array = odbc_tables($conn); $names = array(); $i = 0; odbc_fetch_row($array); echo $i."<br>"; $i = odbc_fetch_row($array); echo $i."<br>"; $temp = odbc_result($array, "TABLE_NAME"); echo $temp; ?> But this doesn't: <? $array = odbc_tables($conn); $names = array(); $i = 0; // add extra assign of $i to odbc_fetch $i = odbc_fetch_row($array); echo $i."<br>"; $i = odbc_fetch_row($array); echo $i."<br>"; $temp = odbc_result($array, "TABLE_NAME"); echo $temp; ?> It seems like I can only assign or check odbc_fetch_row() and odbc_results() a total of two times. If I don't check or assing anything, I can get to the eigth row. If I do check or assign more than 2 twice, I get a cgi error or it just sits acting like its loading stuff. With some help, I found out that you can get around the problem by closing the connection and opening it again. I've also found that something like $num = count($array) will not work if you've already used you're 2 fetch_row)/results() assigns, but if you close the connection it will work again. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=12263&edit=1
