Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- /* DB Information */
- $name = ''; //db name
- $user = ''; //user name
- $pass = ''; //password
- $host = ''; //host
- /* DB Information */
- $connect = mysqli_connect($host, $user, $pass, $name);
- if (mysqli_connect_errno()) {
- echo '<b>CONNECTION FAILED:</b> ' . mysqli_connect_error();
- } else {
- echo '<b>CONNECTION SUCCESS!</b></br></br><u>TABLES</u></br>';
- // Table names and columns.
- $test_query = "SHOW TABLES FROM $name";
- $result = mysqli_query($connect, $test_query);
- $tables = 0;
- while($tbl = mysqli_fetch_array($result)) {
- $tables++;
- echo '</br>' . $tbl[0] . '</br>';
- $test_column = "SHOW COLUMNS FROM $tbl[0]";
- $column_result = mysqli_query($connect, $test_column);
- while($col = mysqli_fetch_array($column_result)) {
- echo ' "' . $col[0] . '" ';
- }
- echo '</br>';
- }
- if (!$tables) {
- echo 'Table Not Found.</br>';
- } else {
- echo '</br><em>Total ' . $tables . ' Tables</em></br>';
- }
- }
Add Comment
Please, Sign In to add comment