Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql config question

Status
Not open for further replies.

Rizzler

Technical User
Feb 9, 2006
43
SE
hey i have a problem.

i have a mysql php script on that checks the size of my sql, as you can se on the link above nothing is shown on the page thou. BUT as i upload the EXACT same script to another server that has the same settings as mine. same mysql database name and password etc
there it works but not on my server and i wonder why? my server say that mysql is running. i can connect to it with mysql query browser and so on, is this cause of my PHP.ini settings ?
 
Its possibly more related to PHP, but could be down to permissions in mysql, or host config in mysql.

post code, will look.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
is it the php.ini file you want to look at? if so it's here
hat to rename it to txt due to IIS <.<

and the code for mysqlsize is here.

<html>
<head><title>mySQL database size</title></head>
<body>
<h1>MySQL Database Size</h1>
<?php
function file_size_info($filesize) {
$bytes = array('KB', 'KB', 'MB', 'GB', 'TB'); # values are always displayed
if ($filesize < 1024) $filesize = 1; # in at least kilobytes.
for ($i = 0; $filesize > 1024; $i++) $filesize /= 1024;
$file_size_info['size'] = ceil($filesize);
$file_size_info['type'] = $bytes[$i];
return $file_size_info;
}
$db_server = 'localhost';
$db_user = 'root';
$db_pwd = 'iremovedthepassword';
$db_name = 'rizzler';
$db_link = @mysql_connect($db_server, $db_user, $db_pwd)
or exit('Could not connect: ' . mysql_error());
$db = @mysql_select_db($db_name, $db_link)
or exit('Could not select database: ' . mysql_error());
// Calculate DB size by adding table size + index size:
$rows = mysql_query("SHOW TABLE STATUS");
$dbsize = 0;
while ($row = mysql_fetch_array($rows)) {
$dbsize += $row['Data_length'] + $row['Index_length'];
}
print "database size is: $dbsize bytes<br />";
print 'or<br />'; $dbsize = file_size_info($dbsize);
print "database size is: {$dbsize['size']} {$dbsize['type']}"; ?>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top