Display Random Records

Results 1 to 4 of 4

Thread: Display Random Records

  1. #1
    Join Date
    Dec 1969

    Default Display Random Records

    HI There..<BR> Suppose i have a table which has some 50 questions : <BR>Now, if i have to fetch just 10 questions , IN ANY RANDOM ORDER (this is important), within this recordset , how do i do that... This is basically when the user refreshes the page, he/she should be able see a NEW set of questions every time<BR> Seems simple, isnt it ? i know. that the reason why i have posted it here... expecting a prompt answer<BR><BR>Nike

  2. #2
    4GuysFromIndia Guest

    Default RE: Display Random Records

    hi nike,<BR> well, you just have to take a variable rather an array, which will the store the random numbers, the random number generator code is:<BR> Randomize<BR> arr = (ubound - lbound) * rnd - 1<BR>e.g.<BR> arr = cint((50 - 1) * rnd - 1)<BR>so, the variable arr will store the random number, put this in an for loop, and use this is the field id to read from the database.

  3. #3
    4guysfromvikhroli, right? Guest

    Default RE: Display Random Records

    hehehe..<BR> sorry, dear, i think i know who is doing the talking here !.. if it were that simple, i cud have figured that out myself... It isnt as simple as u think...You did NOT get the requirement correctly... By this methodology, there&#039s a chance that some records might get repeated..<BR> Anyways, i have figured out a way myself ... IT&#039s effective and ,moreover, perfect... Just a brainstorm took me by storm...<BR> Thanks for your help, anyway...

  4. #4
    BalletChick Guest

    Default RE: Display Random Records

    If you would use the search feature of this website, or learn how to use a generic search engine, you would quickly find that the answers to your questions have already been exhaustively researched and documented. Here are just a few examples from this website alone:<BR><BR>http://www.4guysfromrolla.com/webtech/081100-1.shtml<BR>http://www.4guysfromrolla.com/webtech/072799-1.shtml<BR>http://www.4guysfromrolla.com/webtech/102999-1.shtml<BR>http://www.sqlteam.com/item.asp?ItemID=217<BR>http://www.sqlteam.com/item.asp?ItemID=576<BR><BR>Hope this helps! :)<BR><BR>

Posting Permissions

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