[thelist] Re: php mysql ORDER BY
Lachlan Cannon
luminosity at members.evolt.org
Tue Jan 14 06:25:01 CST 2003
> Thanks ever so much for that rudy, but I can't remember how to put the numbers
> I've grabbed into the second statement.
>
> // grab 5 random rows
> $random = mysql_query("SELECT quizid FROM $table ORDER BY RAND() LIMIT 5",$db);
>
> // grab data for those 5 rows
> $display = mysql_query("SELECT * FROM $table WHERE quizid in (how do I get
> those numbers in here?) ORDER BY quizid",$db);
$array = mysql_fetch_array($random);
$nums = implode(',',$array);
$sql = "SELECT * FROM $table WHERE quizid in ($nums) ORDER BY quizid";
...
HTH
--
Lach
__________________________________________
Web: http://illuminosity.net/
E-mail: lach @ illuminosity.net
MSN: luminosity @ members.evolt.org
__________________________________________
More information about the thelist
mailing list