From: [EMAIL PROTECTED]
Operating system: Windows 2000
PHP version: 4.0.6
PHP Bug Type: ODBC related
Bug description: odbc_tables() does not close automatically ODBC MSAccess connection
This is a bug report and, i think, also a solution report. If u use the
canonical syntax to retrieve table names from a Microsoft Access ODBC
connection on windows 2K (dunno if this happen with previous versions)
using ZEND PHP 4.0.6 engine, you will see your page to fall in a deep
endless loop without waking up. The workaround, that is also a good coding
practice, is to close all you left open: so use odbc_close_all() and your
sleepy page turn to wake up without a prob!
Here it is my piece of code to accomplish the whole job:
<script language="php">
//
// ODBC database table names retrieve with odbc_tables()
//
error_reporting (E_ALL);
$the_connection="test";
$ODBCConn=odbc_connect($the_connection, "", "",SQL_CUR_USE_ODBC) or
die("DSN error!");
$i=0;
$recordset=odbc_tables($ODBCConn);
while(odbc_fetch_row($recordset))
{
// In MSAccess the first 5 tables are used by the application and we
don't care of them
if (++$i <= 5) echo ":: SYSTEM TABLE :: ";
echo odbc_result($recordset, "TABLE_NAME")."<br>\n";
}
flush(); // this is merely optional
odbc_close_all(); // don't forget this!!!
</script>
--
Edit bug report at: http://bugs.php.net/?id=14216&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]