PHP 4.0 Bug #10302 Updated: odbc_tables()
| From: | john at milnedunn dot netscapeonline dot co dot uk | Date: | Mon, 23 Apr 2001 16:27:53 +0000 |
| Subject: | PHP 4.0 Bug #10302 Updated: odbc_tables() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52215@lists.php.net to get a copy of this message | ||
ID: 10302
User Update by: john@milnedunn.netscapeonline.co.uk
Old-Status: Feedback
Status: Open
Bug Type: ODBC related
Description: odbc_tables()
code example:-
<?php
$dsn="php"; // System DSN
$user="GUEST";
$passwd="";
$db = odbc_connect($dsn,$user,$passwd);
if(!$db) {
echo "SORRY: could not connect to database<br>";
die();
}
//------------------------------------------------
// get table list
//------------------------------------------------
$table_list=array();
$result = odbc_tables($db);
if($result) {
$count=0;
// debug lines
echo odbc_num_rows($result) . " Tables found <br>";
odbc_result_all($result);
// end debug
while(($report = odbc_fetch_row($result))) {
$row[$count] = odbc_result($result,3);
$count++;
}
if($count > 0) {
sort($row);
for(reset($row);$table_list[]=current($row);next($row)) { }
} else {
echo "SORRY. I Can't Get The Table Details<br>";
die();
}
}
//-------------------------------------------------
// get field names
//-------------------------------------------------
if(!$tables)
$tables=$table_list[0];
$result = odbc_columns($db,"","","$tables");
if($result) {
$row=array();
$count=0;
while(($report = odbc_fetch_row($result))) {
$row[$count] = odbc_result($result,4);
$count++;
}
if($count > 0) {
sort($row);
for(reset($row);$columns[]=current($row);next($row)) {}
} else {
echo "SORRY. I Can't Get The Field Details<br>";
die();
}
}
odbc_close($db);
odbc_num_rows() returns a count of tables in the database,
odbc_results_all() returns no rows,
odbc_fetch_row() returns false.
Previous Comments:
---------------------------------------------------------------------------
[2001-04-18 21:37:34] kalowsky@php.net
can you please provide a sample script on how to reproduce this?
---------------------------------------------------------------------------
[2001-04-12 10:47:08] john@milnedunn.netscapeonline.co.uk
I think this may have been an issue in a previous release but I am still having it in this version.
after calling odbc_tables() I can not get the results using odbc_fetch_row() or odbc_result_all(),
but odbc_num_rows() does return the number of tables in the database.
The system is using the precomplied version downloaded from zend with the default php.ini file. Oh
and in ISAPI mode!
Thanks
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=10302