Hello, I have searched google and havent found a working link. Can anyone point me in a direction. I know how random text and images work but i cannot see how to do a random page. The reason im asking is that when someone comes to my page I want to display a different crossword or wordsearch puzzle without manually updating it Any help would be wonderful.
just use order by rand() LIMIT 10 in your mysql query to pull 10 random records in your database. Pull the records from the recordset and display it.
Yes, It would help if you provided us with more information about your page. If your trying to load a random html file I would use php's rand() function. If you ware trying to load random mysql results I would use mysql's rand function.
If would be a random php page. Like for instances. I have a puzzles on playwordsearch.com One time a Sports Puzzle would load.. another time another puzzle. Hopefully not using MSQL to do this. But more then willing to
I am not sure what you need, do you want something like this? <?php $mypages = array("mypage1.html", "mypage2.html", "mypage3.html", "mypage4.html", "mypage5.html"); $myrandompage = $mypages[mt_rand(0, count($mypages) -1)]; echo $myrandompage; ?> Code (markup):
Yes I think extromaster has submitted a script,,,.. in which it display random pages ...................It can work on PHP 4, PHP 5)
For anyone who comes across this post now (2 years later), this is what I did to get the method listed above to work <?php $mypages = array("mypage1.html", "mypage2.html", "mypage3.html", "mypage4.html", "mypage5.html"); $myrandompage = $mypages[mt_rand(0, count($mypages) -1)]; include ($myrandompage); ?> Code (markup): Just needed to change the "include" a little