Re: using rand()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> why not do two select statements using the ORDER BY RAND() then append:
>
> LIMIT 3 for your women,
>
> and then
>
> LIMIT 1 for your men
>
>
>
> so the first one is:
>
> $result1 =
> mysql_query("select * from {table} where sex='female' order
> by rand() limit 3;");
>
> the second:
>
> $result2 =
> mysql_query("select * from {table} where sex='male' order
> by rand() limit 1;");
>
>
>
> where {table} is the name of your table...
>
>
>
> drew

Thanks Drew,

Simple solution to a simple problem.....guess I'm sitting on my brains right
now...or am just braindead.
Time for a break and guitar playing :-)

Cheers,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.4 - Release Date: 4/6/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux