Bruce Levick - VivamotionI was curious as to what is the best way to select
a random row from a table in my database.
I have currently five rows and will be expanding on that as well. I have
tried this code.
########################################################################
//retrieve random row
<?php
$rndm = mysql_query("SELECT * FROM Illustrations ORDER BY RAND() LIMIT 1");
if (!$rndm) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
?>
######################################################################
output random row
<?php
print "<b>$rndm[titletext]</b>\n";
?>
######################################################################
but am not getting anything when output with PHP in a browser. I am working
off localhost on a WINXP machine. PHP 4.2.2.
Cheers
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php