Ok, I have looked through the archives on both MySQL and PHP's lists, but I have not seen this asked or mentioned. Weird, I thought this would be a common thing. Is there a better way to randomly select a table from a database, than what I have come up with:
<?php srand ((float) microtime() * 10000000); $table_array = array (); mysql_connect("localhost", "mysql_user", "mysql_password"); $result = mysql_list_tables("database_name"); for ($i = 0; $i < mysql_num_rows($result); $i++) { $table_name = mysql_tablename($result, $i); array_push ($table_array , "$table_name"); } $rand_keys = array_rand ($table_array, 2); echo "<br><br>Here is a random table: <b>" . $table_array[$rand_keys[0]]."</b><br>\n"; mysql_free_result($result); ?> thanks, DB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php