Re: randomly select a table, better way?

From: Date: Tue, 02 Sep 2003 06:25:55 +0000
Subject: Re: randomly select a table, better way?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-161419@lists.php.net to get a copy of this message
On Tuesday 02 September 2003 08:17, Daniel Bray wrote: > 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. You didn't RTFM -> mysql_list_tables() mysql_tablename() mysql_fetch_array() and friends -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Intuition, however illogical, is recognized as a command prerogative. -- Kirk, "Obsession", stardate 3620.7 */

« previous php.general (#161419) next »