On Saturday 18 May 2002 18:00, you wrote:
> yeah i tried doing that in phpMyAdmin, and it gave me an error
> and when i use
>
> SELECT * FROM 4172_questions ORDER BY RAND() LIMIT $row
>
> ($row being the number of rows)as my query it gives me the:
>
> Warning: Supplied argument is not a valid MySQL result resource in
> /home/blindtheory/web/quiz/take_quiz/take_quiz_question_1.php on line 15
>
> error.
>
> Jule.
>
> On Saturday 18 May 2002 17:46, you wrote:
> > 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 sample of a set SELECT *
> > FROM table1,table2 WHERE a=b AND c<d ORDER BY RAND() LIMIT 1000. Note
> > that a RAND() in a WHERE clause will be re-evaluated every time the WHERE
> > is executed. RAND() is not meant to be a perfect random generator, but
> > instead a fast way to generate ad hoc random numbers that will be
> > portable between platforms for the same MySQL version. "
> >
> > Cheers!
> >
> > Rick
> >
> > Nobody will ever win the Battle of the Sexes. There's just too much
> > fraternizing with the enemy. - Henry Kissinger
> >
> > > 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 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 again. and that after it
> > > has printed all the records it stops
> > > any ideas?
> > >
> > > 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   |
|   __________________________   |
|/\/                          \/\|

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to