Hi,

I have been playing around with RAND(). It works very well if I do a sql statement with mysql, but I having problem using with mysql statement with php. When a person calls on the page, the same output is always view. How can I get RAND() work with php.

sorry for the php, stuff. Thanks for any help you can give.

Payne

<?

$db = mysql_connect("127.0.0.0","fred","mrbill");

mysql_select_db("links",$db);

$result = mysql_query("SELECT url FROM sponsors order by rand() LIMIT 1", $db);

if ($myrow = mysql_fetch_array($result)) {

echo"<table width='500' border='0' cellspacing='0' cellpadding='0'>";
do {
printf("<tr><td>%s</td></tr>\n",$myrow[url]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no message of day today";
}


echo "</table>"

?>



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to