note 90532 deleted from function.odbc-tables by danbrown
| From: | danbrown@php.net | Date: | Mon, 27 Apr 2009 14:24:34 +0000 |
| Subject: | note 90532 deleted from function.odbc-tables by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153811@lists.php.net to get a copy of this message | ||
Note Submitter: anuga at anuga dot se
----
I've been toying around, trying to do this as simple, safe and fast and possible.
<?php
/* Setup ODBC Connection */
if(!$odbc['connection'] = odbc_connect('DNS','USER','PASS'))
{
exit("Connection Failed<br />\n");
}
else
{
echo("Connected<br />\n");
}
/* Fetches The Tables Into an Array*/
if($result = odbc_tables($odbc['connection']))
{
while(odbc_fetch_row($result))
{
$odbc['rows']['tables'][] = odbc_result($result,"TABLE_NAME");
}
odbc_free_result($result);
}
/* Close The Connection */
if(odbc_close($odbc['connection']))
{
odbc_close($odbc['connection']);
}
/* Print The Array */
if(!empty($odbc['rows']))
{
print_r($odbc['rows']);
}
?>