
January 19th, 2007
01:31 PM
Neverside Newbie
Status: Offline!
Pull random data from DB
As the title suggest, I'm working on a website that would extract then post random data from the DB (let's just say 10 data entry out of 2000 entries for now) on the front page.
I thought of using 10 random number and then extract those 10 entries from the DB, but then I thought that would be too much work if I decide to change from 10 entries to 20 later on.... is there a better idea?

January 19th, 2007
02:50 PM
I think a random number is the best way forward, seems the most logical as well.

January 19th, 2007
09:52 PM
funny and cheeky
Status: Offline!
droomagon why do u say it's too much work? It's a basic script. All u need is a for loop and rand function function built into php. http://uk.php.net/manual/en/function.rand.php. U pass the number to mysql results function. Have a look at the mysql functions. Most of the tutorials i've seen use mysql result but there others.
Last edited by schoi, January 19th, 2007 09:54 PM (Edited 1 times)