|
-
May 10th, 2003, 10:35 AM
#1
Thread Starter
Addicted Member
Asking for making random array for displaying on the page
Random for displaying rows from database
I did query and get all of the rows in my table test . Each row in my database include fields like this : id , ask , a , b , c , d , answer . All are 7 fields . When display on a page i want it to be displayed in inorder , in random the with the field ID and in the row the 4 fields a,b,c,d are all displayed in an inorder too . Telling this is so hard to imaging so i am trying to put an example here . This is a projest of mine , doing the work of a test with a question and 4 choies for ppl to choose the answer .
Display1 :
1. Question A
a. Choice a
b. Choice b
c. Choice c
d. Choice d
2 Question B
a. Choice d
b. Choice a
c. Choice b
d. Choice c
..................
Display 2
1. Question B
a. Choice d
b. Choice a
c. Choice c
d. Choice b
2 Question A
a. Choice b
b. Choice c
c. Choice a
d.Choice d
......................................
This mean that when a user visit this page , they can see this order , but another one visit this page it will change into another oder with the same question thy can see the oder of the questions are not the same .
Have anyone has gotten over this before please tell me what to do . Maybe now i need your algorithsm
-
May 11th, 2003, 08:23 PM
#2
Stuck in the 80s
Try:
Code:
SELECT * FROM table_name ORDER BY RAND()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|