Ok i got a simple problem... What im trying to do is grab the newest 15 links which I have a TIME table for, then out of those new 15 i want to choose 1 random link. The code below works, but it grabs 15 randoms out of the entire 200 link list then chooses one. $result=mysql_query("select * from babeloggerv3 where approved = 'yes' AND '".time()."'>=time ORDER BY RAND() LIMIT 1, 15"); while($row=mysql_fetch_array($result)){header("Location: http://www.needbang.com/plugs/out.php?id=$row[id]");} Code (markup): -thanks in advance -tommy
I would grab the newest 15 links from the database without using rand, then use php functions or your own function to choose a random id from that array, or maybe theres another way, I'm v drunk, I'd write some code but it would prolly turn out japanese we'll see how you're doing in the morning .....
EDIT: ^^ Hahah. Try $result=mysql_query("select id from babeloggerv3 where approved = 'yes' AND '".time()."'>=time LIMIT 1, 15"); header("Location: http://www.needbang.com/plugs/out.php?id=" . mysql_result($result, rand(0, 14))); PHP: