View Full Version : Random Selection from database...
The Wizzard
01-24-2003, 12:28 AM
Hi everyone!
Lets say I have 6 items in my database.
And I want to randomly select 1 and display it, how would I do this?
justame
01-24-2003, 01:42 AM
wiz...
just a checkout® this link...
http://www.webmasterworld.com/forum47/266.htm
oracleguy
01-24-2003, 01:42 AM
One way I know of using ASP... I'm still not up on all the functions you can do in SQL so there might be a way to do it there.
but here is a asp way:
Randomize
Dim intRandom, strQuery
intRandom=int((rnd*MaxValue)+MinValue)
strQuery="SELECT * FROM mytable WHERE ID='"&intRandom&"';"
Try that.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.