Bruce Levick - Vivamotion Been searching for an answer to selecting a random table and then a random row within the selected table. I have this code which successfully selects a random row within a hard coded table. But just can't get the random table working. <?php //trying to select all tables from the database portfolio........pfff $alltables = mysql_list_tables("portfolio"); //trying to get the array value of the alltables...there are 4 tables in the database. So as far as I know the value of $alltables should be 3. (0table, 1table, 2table, 3table) $randtabnum = array($alltables); // this selects everything from the Illustrations table. I need to make the FROM table_name a random selection $all = mysql_query("SELECT * FROM Illustrations"); //acquires total rows $totalRows_Recordset1 = mysql_num_rows($all); // selects random row from total rows $rndm = mysql_query("SELECT * FROM Illustrations ORDER BY RAND() LIMIT 4,$totalRows_Recordset1"); if (!$rndm) { echo("<P>Error performing query: " . mysql_error() . "</P>"); exit(); } $randrow = mysql_fetch_array($rndm); ?> Anybody see the solution?? Winxp Pro, php 4.2.2 Mysql 3.2 Cheers -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php