|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12263 odbc_tables(), odbc_results()
Submitted: 2001-07-19 14:27 UTC Modified: 2002-05-30 07:25 UTC
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mklangem at uwaterloo dot ca Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.0.6 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mklangem at uwaterloo dot ca
New email:
PHP Version: OS:


 [2001-07-19 14:27 UTC] mklangem at uwaterloo dot ca
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; 
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-30 07:25 UTC]
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

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.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Dec 04 22:05:52 2022 UTC