I don't know if this will work or not, but try

SELECT * FROM table ORDER BY id, RAND();

That should keep all of the questions and answers together, but give a
random order for the answers.. ?? Like I said, not exactly sure on it
though.

Best option, like someone else said, is to split this up into two
tables. 

---John Holmes...

> -----Original Message-----
> From: Jule [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, May 12, 2002 1:28 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
> [EMAIL PROTECTED]
> Subject: Re: [PHP] random order
> 
> hmm it got a little more complicated now,
> i have a table with: id title question answer1 answer2 answer3
answer4.
> how can i use all of those in a php page but only randomize the
answers?
> 
> so i get
> 
> title         title
> 
> question      question
> 
> answer3               answer4
> answer2               answer1
> answer4               answer3
> answer1               answer2
> 
> any ideas?
> thanks,
> 
> Jule
> On Sunday 12 May 2002 17:30, you wrote:
> > Add on a LIMIT to restrict it to return a certain number of rows.
> >
> > If you had a table of say, 100 rows, and you wanted four random ones
out
> > of the 100, then you'd use this:
> >
> > SELECT * FROM table ORDER BY RAND() LIMIT 4;
> >
> > ---John Holmes...
> >
> > > -----Original Message-----
> > > From: Jule [mailto:[EMAIL PROTECTED]]
> > > Sent: Sunday, May 12, 2002 11:22 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] random order
> > >
> > > Thanks John,
> > > I thought that that command only selected a random row..
> > > must've read wrong.
> > > thanks.
> > >
> > > Jule
> > >
> > > On Sunday 12 May 2002 17:21, you wrote:
> > > > Nothing to do with PHP...
> > > >
> > > > SELECT * FROM table ORDER BY RAND();
> > > >
> > > > ---John Holmes...
> > > >
> > > > > -----Original Message-----
> > > > > From: Jule [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Sunday, May 12, 2002 9:49 AM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: [PHP] random order
> > > > >
> > > > > Hey guys and gals,
> > > > > I have a problem:
> > > > > I have a mysql databse with 4 rows, and each row (row1, row2,
> >
> > row3,
> >
> > > > and
> > > >
> > > > > row4)
> > > > > contains a sentence. now i want these sentences to appear in
> >
> > random
> >
> > > > order:
> > > > > instance: 1     2    etc.
> > > > >        row2  row4
> > > > >        row4  row2
> > > > >        row1  row1
> > > > >        row3  row3
> > > > >
> > > > > how do i go about that??
> > > > > any ideas apreciated.
> > > > > thanks
> > > > >
> > > > > Jule
> > > > > --
> > > > >
> > > > > |\/\__________________________/\/|
> > > > > |   Jule Slootbeek             |
> > > > > |   [EMAIL PROTECTED]      |
> > > > > |   http://blindtheory.cjb.net         |
> > > > > |   __________________________         |
> > > > > |/\/                        \/\|
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > > --
> > >
> > > |\/\__________________________/\/|
> > > |   Jule Slootbeek                 |
> > > |   [EMAIL PROTECTED]  |
> > > |   http://blindtheory.cjb.net     |
> > > |   __________________________     |
> > > |/\/                            \/\|
> 
> --
> |\/\__________________________/\/|
> |   Jule Slootbeek             |
> |   [EMAIL PROTECTED]      |
> |   http://blindtheory.cjb.net         |
> |   __________________________         |
> |/\/                        \/\|


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to