$first = rand(0,mysql_query("SELECT COUNT(*) FROM `randomurl`"))
$query = mysql_query("SELECT url FROM `randomurl` LIMIT $first,1");
$url = mysql_result($query,0,"url");
header("location: $url");
shinyblogs.com said:That looks like it should work. You never use $second after assigning it, though. And if performance is an issue, changing the first query to be a SELECT COUNT(*) instead of counting the number of rows returned would be quicker. But otherwise, yeah, that should do it.
$urls = array(1 => "www.google.com",
"www.freewebspace.net/forums",
"example.com");
echo "<meta http-equiv='refresh' content='0;url=http://".$urls[array_rand($urls)]."'>";