[ale] recommend a good PHP/MYSQL list?
ChangingLINKS.com
x3 at ChangingLINKS.com
Fri Apr 18 17:05:30 EDT 2003
Nah. What I am trying to do is more complex. The closest thing I could find is
like a cross between a subselect and a sort:
/*
http://www.mysql.com/doc/en/ANSI_diff_Sub-selects.html
http://www.mysql.com/doc/en/Sorting_rows.html
*/
I want to select random records from the table AND list the result order by id
DESC;
Without throwing the data into an array (cause I really don't know how :)).
Something like this:
///
$sql="select value from table order by rand(), order by id desc limit 20";
$result=mysql_query($sql);
while ($myrow=mysql_fetch_array($result))
{
$value=$myrow["value"];
printf ("value");
///
(So take 20 random rows -of the 1000 that exist- AND order by id DESC)
I am thinking someone would suggest grabbing the random records and sorting
them in the while array somehow. But that is over my head (which is why I
turned to the mySQL queries). I couldn't find that concept in the manual.
Drew
On Fri April 18 2003 15:34, F. Grant Robertson wrote:
> Mysql can return random rows.. or you could generate psuedo random numbers
> and query by WHERE IN (1,2,3,4,5)
>
> Take a look at the mysql manual..
>
> http://www.mysql.com/doc/en/index.html
>
> -G
>
>
> -----Original Message-----
> From: ale-admin at ale.org [mailto:ale-admin at ale.org]On Behalf Of
> ChangingLINKS.com
> Sent: Friday, April 18, 2003 4:05 PM
> To: ale at ale.org
> Subject: [ale] recommend a good PHP/MYSQL list?
>
>
> That php-ale list hasn't materialized yet, and I am not thinking I should
> post lots of php questions (though it would be a positive offset to the
> flame battles that arise).
>
> Can someone recommend a great php list (from experience)?
>
> I am trying to grab random records from a mysql database and put them in
> order desc by primary key in one query.
--
Wishing you Happiness, Joy and Laughter,
Drew Brown
http://www.ChangingLINKS.com
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list