Calcular tamaño BBDD en MySQL


/ Published in: PHP
Save to your folder(s)

Extraido de Good PHP Tutorials, un articulo de Tim Bennett


Copy this code and paste it in your HTML
  1. <?php
  2. $dbname = "databasename";
  3. mysql_select_db( $dbname );
  4. $result = mysql_query( "SHOW TABLE STATUS" );
  5. $dbsize = 0;
  6.  
  7. while( $row = mysql_fetch_array( $result ) ) {
  8.  
  9. $dbsize += $row[ "Data_length" ] + $row[ "Index_length" ];
  10.  
  11. }
  12. echo "<p>The size of the database is " . formatfilesize( $dbsize ) . "</p>";
  13.  
  14. ?>

URL: http://www.goodphptutorials.com/track/163

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.