|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-06-03 06:26 UTC] jma at jma dot se
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);
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 10:00:01 2025 UTC |
A shorter version of this crash is : $ms = odbc_connect("moo", "", ""); $th = odbc_tables ($ms); while (odbc_fetch_row($th)) { odbc_free_result($th); }