0
$tdb = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=$sdltdbsavedfilename; Uid=; Pwd=;");
$sql = 'SHOW TABLES';
$tdbresult = $tdb->query($sql);
var_dump($tdbresult);

Gives: Fatal error: Uncaught PDOException: SQLSTATE [42000] : Syntax error or access violation: [Microsoft] [ODBC Microsoft Access Driver] SQL statement is not correct. Use 'DELETE' 'INSERT', 'PROCEDURE', 'SELECT' OR 'UPDATE'. (SQLPrepare [0] at ext\pdo_odbc\odbc_driver.c:203)

What is the right way?

Loek van Kooten
  • 103
  • 1
  • 7

2 Answers2

0

Try query the system table:

$sql = 'Select Name From MSysObjects Where Flags = 0 And Type = 1';
Gustav
  • 53,498
  • 7
  • 29
  • 55
0

In the end I went for this solution instead:

Check if a database table exists using PHP/PDO

So instead of searching all tables, I just try one and check whether it exists before proceeding.

Loek van Kooten
  • 103
  • 1
  • 7