Bug #17572: Calling odbc_tables crashes
| From: | jma at jma dot se | Date: | Mon, 03 Jun 2002 10:26:13 +0000 |
| Subject: | Bug #17572: Calling odbc_tables crashes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-9288@lists.php.net to get a copy of this message | ||
From: jma@jma.se
Operating system: W2K, FP2
PHP version: 4.2.1
PHP Bug Type: Reproducible crash
Bug description: Calling odbc_tables crashes
This script crashes after showing the first table.
This is consistant on several ODBC sources (tried Access, Foxpro and
DB2).
This script worked with 4.0 versions.
<?php
$host = ""; // Enter your ODBC connection here
$uid = "";
$pwd = "";
$ms = odbc_connect($host, $uid, $pwd);
$th = odbc_tables ($ms);
while (odbc_fetch_row($th))
{
if (odbc_result($th, "TABLE_TYPE") == "TABLE")
{
$table = odbc_result($th, "TABLE_NAME");
printf("<H2>%s</H2>\n", $table);
$fh = odbc_columns($ms);
echo "<BLOCKQUOTE>\n";
echo "<TABLE BORDER=0 CELLPADDING=10>\n";
while (odbc_fetch_row($fh))
{
if (odbc_result($fh, "TABLE_NAME") == $table)
{
printf("<TR>");
printf("<TD>%s</TD>", odbc_result($fh,
"TYPE_NAME"));
printf("<TD><B>%s</B></TD>",
odbc_result($fh,
"COLUMN_NAME"));
switch (odbc_result($fh, "DATA_TYPE"))
{
default:
}
printf("</TR>\n");
}
}
echo "</TABLE>\n";
echo "</BLOCKQUOTE>\n";
odbc_free_result($th);
}
}
odbc_free_result($th);
odbc_close ($ms);
?>
--
Edit bug report at http://bugs.php.net/?id=17572&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17572&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17572&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17572&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17572&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17572&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17572&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17572&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17572&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17572&r=globals