PHP ODBC - Access 2007: Function Call Problems: odbc_columns
I have mananed to use the odbc_connect like the following for access 2007 and 2003 and I can get data. But when I try to get the column names the following function will not work for access 2007 but will for acccess 2003 - why?
if($type[1]=='mdb'){
$connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename", $username, $password);
}else{
$connection = odbc_connect("Driver={Microsoft Access Driver (*.accdb)};Dbq=$mdbFilename", $username, $password);
}
function get_columns($activity_file){
global $connection;
global $typee;
$coulmn_array = array();
$result = odbc_columns($connection, $typee, "", $activity_file, "%");
while (odbc_fetch_row($result)) {
$coulmn_array[] = odbc_result($result, "COLUMN_NAME");
}
echo '<br>Exporting table '.$activity_file;
return $coulmn_array;
}
I mean I can get the data and everything, it just seems this function just won't work!
Please help!
Update
I had a google around and found this thread.
I can confirm what this person is saying. Supplying a table_name means this won't work. But if you don't it will. This isn't ac开发者_运维技巧ceptable as what columns are being returned and for what table? I need to know this!!
This is a long shot, but there was a problem with the ODBC function SQLDescribeCol and SQLColAttributes related to Access 2007. Those functions would likely be used by odbc_columns
. It is described in this KB article.
精彩评论