> 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
t a random sample of a set SELECT * FROM
table1,table2 WHERE a=b AND c From: Jule <[EMAIL PROTECTED]>
> Date: Sat, 18 May 2002 17:41:59 -0400
> To: [EMAIL PROTECTED]
> Subject: [PHP] random order by id
>
>
> Hey guys,
> i have a db and a table with id and questions
> now
Hey guys,
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?
i can ofcourse select a random one, that's no problem, but how do i make
sure that that one does not get chosen a
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
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
> 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
> 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
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
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
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 2etc.
row2 row4
row4 row2
row1 row1
row3 row3
10 matches
Mail list logo