Použijte SHOW TABLES
:
$pdo = new PDO('mysql:dbname=mydb', 'myuser', 'mypass');
$stmt = $pdo->query('SHOW TABLES;');
if ($stmt->rowCount() > 0) {
$tables = $stmt->fetchAll(PDO::FETCH_NUM);
foreach ($tables as $table) {
$table_name = $table[0];
// do something
}
}