Random Records

Results 1 to 3 of 3

Thread: Random Records

  1. #1
    Join Date
    Dec 1969

    Default Random Records

    I have been banging my head for days (it hurts) trying to figure out how to disply images in a photo gallery in a random order with each page refresh.<BR><BR>The photo gallery is at http://crimescenedivers.org/photos.asp and is purely database driven.<BR><BR>I have tried several versions of:<BR>Select * from gallery<BR>Order by rnd()<BR>or<BR>Order by rnd(autonumb)<BR> and so on, but without avail.<BR><BR>Does anyone know an easy way to do this?<BR><BR>Thanks, Chuck

  2. #2
    Join Date
    Dec 1969

    Default RE: Random Records

    You may want to try<BR><BR>MyRnd = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)<BR><BR>if MyRnd = 1 then<BR> Myorder = " order by whatever"<BR>end if<BR>if MyRnd = 2 etc .....<BR><BR>then in the sql statment simply write<BR><BR>"Select * from gallery" & Myorder<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default ASPFAQS.COM - Or...

    You can head over to sqlteam.com if you&#039;re using an SQL Server DB and find something on writing your random stuff inside a stored procedure.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts