ZaZaKi, a web developer Between Manchester UK & Rotterdam NL. © 2015-2025.

List all tables of a database

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
  
$pdo = new PDO("mysql:host=localhost", "root", "");
  
$stmtnTable = $pdo->query('SHOW TABLES FROM `mysql`');
  
$tables_name = $stmtnTable->fetchAll(PDO::FETCH_COLUMN);
  
foreach($tables_name as $tableName){
 
  echo $tableName, '<br>';
 
}
?>