PHP – MS Access Get Column Names



$db = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=Northwind.mdb", $username, $pasword);

$cols = odbc_exec($db,”SELECT * FROM Products WHERE 1=2″);
$ncols = odbc_num_fields($cols);

for ($n=1; $n<=$ncols; $n++) {
$field_name = odbc_field_name($cols, $n);
echo $fieldName . ‘<br>’
}

$db = null;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s