Re: Random
| From: | Paul Burney | Date: | Fri, 31 Aug 2001 19:57:17 +0000 |
| Subject: | Re: Random | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12057@lists.php.net to get a copy of this message | ||
> according tho the description at
>
> <http://www.mysql.com/doc/M/a/Mathematical_functions.html>,
> that looks
>> $result = mysql_db_query ("$DBName","select * from Contacts order by rand()
>> LIMIT 5 ");
>> Doesn't work at all. :(
What version of MySQL are you using? I remember something about ordering by
rand() only working in 3.23.xx. If you're using 3.22.xx, it won't work.
You could do something with mysql_data_seek() and the php mt_rand() function
if that's the case. It would be klunky, but you could probably get it to
work.
Sincerely,
Paul Burney
+-------------------------+---------------------------------+
| Paul Burney | P: 310.825.8365 |
| Webmaster && Programmer | E: <webmaster@gseis.ucla.edu> |
| UCLA -> GSE&IS -> ETU | W: <http://www.gseis.ucla.edu/> |
+-------------------------+---------------------------------+