Hmmm... interesting problem (even though I wonder why you'd want having so many tables in your database. Here's how to get the loop for the individual tables:
<?php
$mysql_server = "server.whatever.com";
$mysql_user = "username";
$mysql_password = "pwd";
$mysql_db = "my_db";
mysql_connect($mysql_server, $mysql_user, $mysql_password);
$result = mysql_list_tables($mysql_db);
for ($i = 0; $i < mysql_num_rows($result); $i++) {
$list_of_tables[$i] = mysql_tablename($result, $i);
}
mysql_free_result($result);
?>
Now you have an array($list_of_tables) that contains all of your tables.
Of course you'd still need to go through the individual tables now that you have the list. This shouldn't be a problem as long as all the tables have the same structure (which they might not).