On Mon, 01 Sep 2003 22:49:55 +0000, Curt Zirzow wrote:
> 
> Instead of looping through all the tables and building an array you
> can do something like:
> 
> $n = mysql_num_rows($result);
> $seek = mt_rand(0, $n-1);
> mysql_data_seek($result, $seek);
> 
> 
> Curt

So then the total code would be:

<?
        $mysqlconnect = mysql_connect("localhost", "mysqladmin", "i.hate.microsoft");
        $result = mysql_list_tables("Bookmarks");
        
        $n = mysql_num_rows($result);
        $seek = mt_rand(0, $n-1);
        $random_table = mysql_data_seek($result, $seek);

        echo "<br><br>The randomly slected table was<b>$random_table</b><br><br>";
?>

If so, then this does not work for me.  All I get is $random_table == 1.  If not,
then what am I missing.

Thanks for your quick response, 
DB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to