Posted By

mate on 07/25/06


Tagged

mysql


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

meth
nicolaspar


Calcular tamaño BBDD en MySQL


 / Published in: PHP
 

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

Extraido de Good PHP Tutorials, un articulo de Tim Bennett

  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. ?>

Report this snippet  

You need to login to post a comment.