Voting

: nine minus three?
(Example: nine)

The Note You're Voting On

anuga at anuga dot se
16 years ago
I've been toying around with this for awhile to make it as simple and fast as possible.

<?php

/* Start The Connection */
if(!$odbc['connection'] = odbc_connect('DNS','USER','PASS'))
{
exit(
"Connection Failed<br />\n");
}
else
{
echo(
"Connected<br />\n");
}

/* Select Which Table */
$odbc['table'] = "table";

/* Fetch The Fieldnames into an Array */
if($result = odbc_exec($odbc['connection'],"select * from $odbc['table'];"))
{
for(
$i = 1;$i <= odbc_num_fields($result);$i++)
{
$odbc['rows']['fields'][$i] = odbc_field_name($result,$i);
}
unset(
$i);
odbc_free_result($result);
}
else
{
exit(
"Error in SQL Query");
}

/* Close The Connection */
if(odbc_close($odbc['connection']))
{
odbc_close($odbc['connection']);
}

/* Print The Array */
if(!empty($odbc['rows']))
{
print_r($odbc['rows']);
}

?>

<< Back to user notes page

To Top