Hey I want to get the size of all of the information in a database, I have this code:
That, however, generates this error:PHP Code:<?php
$db = mysql_connect("server", "username","password"); // Connecting to the server.
mysql_select_db("database",$db); // Specify the database.
function mysql_getDatabaseUsage()
{
$result = mysql_query("SHOW TABLE STATUS"); // Get the table status...
while($row = mysql_fetch_array($result)) // Get each row
{
$total = $row['Data_length'] + $row['Index_length']; // Add Data_length and Index_length
}
return($total); // Return the result in bytes.
}
echo(mysql_getDatabaseUsage()); // Echo the amount of the database used that we are currently connected to in bytes.
mysql_close($db); // Close database connection
?>
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in */mysql.php on line 10
* The long directory to the file...
Any help would be well appreciated!



Reply With Quote

Bookmarks