Sometimes you want to have a quick check of your database.

This simple script will give a quick and dirty way to do a check.
PHPmyadmin is of course a proper alternative.
But the way I show here is quicker and very simple.

My script uses MySQLi for connection.
To run you need to configure MySQLi = host, user, pass.
After this you are ready to run.

You submit database name and click submit.
After this you will see all tables and data in your selected database.
If that mysql database does not exist, you will get an error.

PHP Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Dump Database</title>
<style>
    body {background: #c7c7c7; font-size: 12px}
    table {background: #ffffee; border-collapse: collapse}
    th, td{border: 1px solid black}
</style>
</head>
<body>
<?php

if (isset($_POST['database'])) {

    
// MySQLi configure
    
$host 'localhost';
    
$user 'root';
    
$pass '';
    
// End config

    
$base $_POST['database'];
    
$db = new mysqli($host$user$pass);
    if (
$db->connect_error)
        exit(
'Connect Error('.$db->connect_errno.')'.$db->connect_error);
    if (
$db->select_db($base)) {
        
$result $db->query("SHOW TABLES FROM $base");
        
$alltables = new stdClass;
        
$i 0;
        while(
$table $result->fetch_object()) {
            
$i++;
            
$alltables->$i $table->{"Tables_in_$base"};
        }

        echo 
'<h3>Database: '.$base.'</h3>';

        foreach(
$alltables as $table) {

            
$result $db->query("SHOW COLUMNS FROM $table");
            
$allcolumns = new stdClass;
            
$i 0;
            while(
$column $result->fetch_object()) {
                
$i++;
                
$allcolumns->$i $column->Field;
            }
            
$numcol count((array)$allcolumns);
            echo 
'<table>';
            echo 
'<tr><th colspan="'.$numcol.'">'.$table.'</th></tr>';
            echo 
'<tr>';
            foreach(
$allcolumns as $col)
                echo 
'<th>'.$col.'</th>';
            echo 
'</tr>';

            
$result $db->query("SELECT * FROM $table");
            while(
$row $result->fetch_object()) {
                echo 
'<tr>';
                foreach(
$row as $field)
                    echo 
'<td>'.$field.'</td>';
                echo 
'</tr>';
            }
            echo 
'</table><br>';    
        }
        
    } else {
        echo(
'<i>'.$base.'</i> database does not exist.<br><br>');
    }
}
?>

<form method="post" accept-charset="UTF-8">
MySQL database name:<br>
<input type="text" name="database"><br>
<input type="submit"></form>
</body>
</html>