Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2015
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2.  
  3. $db_username = '';
  4. $db_password = '';
  5. $db = new mysqli ('localhost', $db_username, $db_password);
  6.  
  7. echo "----------------   ---------------------\;";
  8. // Get Database List
  9. $query_getDB = $db->query( "SHOW DATABASES" );
  10. //$db_list = array();
  11. while ( $result_db = $query_getDB->fetch_object()) {
  12.     mysqli_select_db( $db, (string)$result_db->Database );
  13.     $query_getTables = $db->query( "SHOW TABLES" );
  14.  
  15.     if ( ( $result_db->Database == 'information_schema' ) || ( $result_db->Database == 'mysql' ) ) {}
  16.     else {
  17.         while ( $result_tables = $query_getTables->fetch_array() ) {
  18.             //print_r($result_tables);
  19.             $sql_total = sprintf( "SELECT COUNT(*) AS `total` FROM `%s`", $result_tables[0] );
  20.             $query_total = $db->query( $sql_total );
  21.             while ( $result_total = $query_total->fetch_object() ) {
  22.                 printf( "%s: %d\n", $result_tables[0], $result_total->total );
  23.             }
  24.         }
  25.     }
  26. }
  27.  
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement