[thelist] php mysql ORDER BY
Dunstan Orchard
dunstan at 1976design.com
Mon Jan 13 06:10:01 CST 2003
Hi there,
I want to be able to select 5 random rows for a db, and then order those rows
by a column called 'quizid'.
Does anyone know how I can do this?
I'm currently making the following call to a db:
$display = mysql_query("SELECT * FROM $table ORDER BY RAND() LIMIT 5",$db);
Which is good for selecting 5 random rows, but also displays them in a random
manner.
I've tried:
$display = mysql_query("SELECT * FROM $table ORDER BY RAND(), quizid ASC LIMIT
5",$db);
but it didn't have any affect on the order they were displayed.
Does anyone have any suggestions?
Thankyou for any help,
- Dunstan
---------------------------
Dorset, England
http://www.1976design.com/
http://www.orchard.it/
http://www.maccaws.org/
More information about the thelist
mailing list