I want to check if a table with a specific name exists in a database I\'ve connected to using PHP and PDO.
It has to work on all database backends, like MySQL, SQLi
This seems to work at least with SQLite3 without exceptions, etc:
$select = "SELECT CASE WHEN EXISTS (SELECT * FROM SQLITE_MASTER WHERE TYPE = 'table' AND NAME = :tableName) THEN 1 ELSE 0 END AS TABLE_EXISTS;";