May the gods of mySQL please forgive me. I just joined the list last night,
and thought, in seeing the question, I could provide a possible solution. I
was unaware that there was only one acceptable answer, and that all posts
had to be pre-checked. In the future I shall not make such a mistake again.

BTW: I've heard of, and use quite frequently, mysql_free_result(). In this
case, I cut-and-pasted (or is that cutted-and-pasted) existing code in an
existing file and at 12:30 a.m. I'm not my sharpest.

And Nick, it is PHP (4), not PERL. I don't know PERL, never written a line
of code in PERL and don't have any immediate plans to learn PERL.

Again I ask forgiveness of the lords and warlocks of the mySQL realm. If a
sacrifice is required, please advise as to the form.

Doug Bishop


-----Original Message-----
From: Georg Richter [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 12:31 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Table statistics


On Thursday, 4. April 2002 08:12, Doug Bishop wrote:

> <?
> mysql_connect("localhost", "user", "password");
> $query = "SHOW TABLES;";
> $result = mysql_db_query("databasename", $query);
> $i = 0;
> while ($row = mysql_fetch_array($result))
> {
>     $tableNames[$i] = $row[0];
>       $i++;
> }
> for ($i = 0; $i <= count($tableNames); $i++)
> {
>       $query = "SELECT COUNT(*) FROM " . $tableNames[$i] . ";";
>       $result = mysql_db_query("databasename", $query);
>       $row = mysql_fetch_array($result);
>       echo "Table " . $tableNames[$i] . " contains " . $row[0] . "
rows.\n<br>";
> }
> ?>

I think Andy asked for a general solution, not for a solution in PHP. Not
all
people are working with PHP. There are a lot of other languages like C,
Perl,
Python, ... which all supports MySQL.

Finally a little note about your PHP Code: Did you ever heard about
mysql_free_result ?!

Regards


Georg


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to