counting tables

counting tables

am 14.05.2007 23:46:40 von laredotornado

Hi,

I'm using PHP 4.4.4 with MySQL 5.0. Given my db connection info, how
would I figure out how many tables were in the selected db?

Thanks, - Dave

Re: counting tables

am 15.05.2007 05:48:49 von Shion

laredotornado@zipmail.com wrote:
> Hi,
>
> I'm using PHP 4.4.4 with MySQL 5.0. Given my db connection info, how
> would I figure out how many tables were in the selected db?

http:/www.php.net/manual/en/function.mysql-list-tables.php

--

//Aho

Re: counting tables

am 15.05.2007 10:42:39 von Tyno Gendo

laredotornado@zipmail.com wrote:
> Hi,
>
> I'm using PHP 4.4.4 with MySQL 5.0. Given my db connection info, how
> would I figure out how many tables were in the selected db?
>
> Thanks, - Dave
>

One way, maybe others that are better?

mysql_connect("localhost", "", "");
mysql_select_db("");
$sql = "SHOW TABLES;";
$ds = mysql_query( $sql );
echo mysql_num_rows( $ds );
mysql_free_result( $ds );
?>

Re: counting tables

am 15.05.2007 19:17:03 von tom

wrote in message
news:1179179200.148304.182970@p77g2000hsh.googlegroups.com.. .
> Hi,
>
> I'm using PHP 4.4.4 with MySQL 5.0. Given my db connection info, how
> would I figure out how many tables were in the selected db?
>
> Thanks, - Dave
>

With MySQL I think you can run a query like "show tables;" and should be
able to get a count from those results.

Tom
--
Newsguy.com - Express Accounts - 30 GB $9.95 / month