RE: [PHP] random order by id

2002-05-18 Thread David Freeman
> i have a db and a table with id and questions > now i want these questions to be listed in a random order, > is there a way to format my SQL query or do i need some PHP > work to? It's best achieved in sql: SELECT ID, Question FROM Questions WHERE Some = Condition ORDER BY RAND() LIMIT

Re: [PHP] random order by id

2002-05-18 Thread Richard Baskett
If you are using MySQL try looking at this page for the function rand(): http://www.mysql.com/doc/M/a/Mathematical_functions.html Here's a little overview of what it says: "In MySQL Version 3.23, you can, however, do: SELECT * FROM table_name ORDER BY RAND() This is useful to get a random sampl

RE: [PHP] random order

2002-05-13 Thread John Holmes
uery would work in other database programs, too. ---John Holmes... > -Original Message- > From: Neil Zanella [mailto:[EMAIL PROTECTED]] > Sent: Sunday, May 12, 2002 9:13 PM > To: John Holmes > Cc: 'Jule'; PHP General Mailing List; MySQL Mailing List > Subjec

RE: [PHP] random order

2002-05-12 Thread John Holmes
is 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 mor

RE: [PHP] random order

2002-05-12 Thread David Freeman
> 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: I've always found mysql's RAND() function to be of use. Specifically: SELECT * FROM MyTable WHERE Some='Condition' ORDER BY RA

RE: [PHP] random order

2002-05-12 Thread David Freeman
> 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? You have multiple questions with the same answers? Then split your table into two tables and p

Re: [PHP] random order

2002-05-12 Thread Jule
u'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 o

RE: [PHP] random order

2002-05-12 Thread John Holmes
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