Listing table names in php

PHP MySQL Functions to list table names in a databases

We can list tables present in a database by using this query
SHOW TABLES
Using this we can develop a PHP script to display all tables.

We can display tables of a database by changing the above query.
SHOW TABLES in PDO
Above query will return all the tables of the database pdo
Similarly if we want to list all the tables starting with char t then we can use LIKE command. Here is the query.
SHOW TABLES from pdo LIKE 't%'
Above query can be placed inside the PHP code [shown above ] to display matching tables. For easy understanding here again the php code.

Chủ Đề