Fw: [PHP] Setting total db size to a variable.
| From: | Jason Martyn | Date: | Sun, 20 Jul 2003 05:10:54 +0000 |
| Subject: | Fw: [PHP] Setting total db size to a variable. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-155937@lists.php.net to get a copy of this message | ||
Theres a problem with the SQL query. It fails? I tried removing the " =
'$tablename' " however, then the mysql_fetch_array cannot save the result
set.
I guess my basic question is how do I query the SHOW TABLE STATUS for a
specific table in a specific database.
<-- Forgot to post this earlier -->
My apologies.
There are 2 databases. The admin database and the registrant info database.
I would like to be able to be able to calculate the size of the combined
databases and use them as a statistic. In the first database there is 5
tables, and in the other database there are 2 tables. I'm using MySQL V.
4.0
and PHP V. 4.3.
<-->
Jay
> ----- Original Message -----
> From: "David Nicholson" <me@djnicholson.com>
> To: "Jason Martyn" <in3words@telus.net>
> Cc: <php-general@lists.php.net>
> Sent: Saturday, July 19, 2003 5:51 PM
> Subject: Re: [PHP] Setting total db size to a variable.
>
>
> Hello,
>
> This is a reply to an e-mail that you wrote on Sun, 20 Jul 2003 at
> 00:42, lines prefixed by '>' were originally written by you.
> > I have a question in regards to finding the total db size and
> setting
> > it to a variable.
> > How would I go about this?
>
> For mysql this will do the trick...
>
> $info = mysql_fetch_array(mysql_query("show table status from
> $databasename = '$tablename'"));
> $sizeinMB = $info["Data_length"]/1024/1024;
>
> --
> phpmachine :: The quick and easy to use service providing you with
> professionally developed PHP scripts :: http://www.phpmachine.com/÷êŸË}%…
> œ×B´
>
> Professional Web Development by David Nicholson
> http://www.djnicholson.com/
>
> QuizSender.com - How well do your friends actually know you?
> http://www.quizsender.com/
> (developed entirely in PHP)
>