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;

Advertisements