From:             [EMAIL PROTECTED]
Operating system: Windows 2000
PHP version:      4.0.6
PHP Bug Type:     ODBC related
Bug description:  odbc_tables(), odbc_results()

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 bug report at: http://bugs.php.net/?id=12263&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to