I have been working on a simple PHP script that called to a mysql database, where I do the following....
SELECT url FROM sponsors ORDER BY RAND();
When I do a refresh I keep getting the same url, I have test this sql statement in mysql and it works great. I think my problem is this...
Here is my php script....
<?
$db = mysql_connect("69.15.40.130","cepayne","death");
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>"
?>
I know that what I have got here must be the problem because this code was use to get mutli line of results. Is there a way to retype this so that I only get the one statement I need?
Payne
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php