php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14216 odbc_tables() does not close automatically ODBC MSAccess connection
Submitted: 2001-11-25 07:20 UTC Modified: 2002-05-24 20:30 UTC
From: astelix at libero dot it Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.0.6 OS: Windows 2000
Private report: No CVE-ID: None
 [2001-11-25 07:20 UTC] astelix at libero dot it
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>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-24 20:30 UTC] derick@php.net
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 http://www.php.net/downloads.php

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 11:01:28 2024 UTC