This project demonstrates how PDO can read MySQL server information, list databases and tables, inspect table structures and display records without hard-coding every column name.
Set the database connection in config.php using the approach described in the PDO connection tutorial, then open index.php. The menu passes the selected database and table between the project pages. For new deployments, use a dedicated database account with only the permissions needed for the task.
The home page can display server information such as the MySQL version and operating environment.
SHOW VARIABLES LIKE '%version%';
The database page lists databases that the configured MySQL account is allowed to see.
SHOW DATABASES;
See also listing MySQL databases.
After selecting a database, the tables page can list the available tables.
SHOW TABLES;
The record page reads the table's columns so the same display logic can be reused across different tables. See displaying MySQL field names. The structure page can read metadata from INFORMATION_SCHEMA.COLUMNS. Values such as schema and table names should be validated against known/allowed identifiers before being used elsewhere in dynamic SQL.
SELECT COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE, COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = :table_name
AND table_schema = :database_name;
See also reading MySQL field types. Use a prepared statement for these metadata values. For SQL identifiers used in commands where placeholders are not accepted, validate them against an allowlist obtained from the server rather than accepting arbitrary request text.
The original project includes links that can empty records or drop a table after confirmation. A browser confirmation is only a user-interface safeguard; authorization must also be enforced on the server. Keep destructive features disabled unless they are specifically needed in an isolated development environment.
config.php stores connection settings, menu.php prepares navigation parameters, database.php lists databases, show-tables.php lists tables, show-records.php displays records, and show-structure.php displays column metadata.
1. Download and extract the ZIP in a local or protected development environment.
2. Open config.php and enter credentials for a least-privilege MySQL account.
3. Open index.php and browse only the databases that account is permitted to access.
4. Keep destructive include/actions disabled unless you intentionally need them.
5. Do not publish the project as an unrestricted database administration interface.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.
| keroles rafat | 27-09-2014 |
| when i click empty or delete nothing happened?why | |
| smo | 27-11-2014 |
| For safety , the part of the code is commented to prevent accidental deletion of records. Search for this line in show-table.php file. Check that this line is not commented. include "drop-empty-table.php"; // Code to delete records and drop table // | |
| iqa | 20-10-2017 |
| can this script be used to display database and tables from postgresql? because i already edit the config.php and still can't display the table and databases name | |
| smo1234 | 22-10-2017 |
| Connecting string is different for different database. The functions at script level in pages for getting the data by using Query is also different. So it will not work. | |
| Rejencra Bardol | 12-10-2018 |
| plus-mysqladmin project is wonderful sir, well done... Thanks for such a wonderful tool for young developers like me. Once again Thanks.. | |