RE: [PHP-DB] Random
| From: | Seb Frost | Date: | Fri, 31 Aug 2001 19:59:16 +0000 |
| Subject: | RE: [PHP-DB] Random | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12058@lists.php.net to get a copy of this message | ||
I know it's documented as rand() but you might want to try random() just in
case... I'm sure I read that somewhere....
- seb
-----Original Message-----
From: John Hurleston [mailto:jhurleston@guia-spain.com]
Sent: 31 August 2001 19:18
To: php-db@lists.php.net
Subject: [PHP-DB] Random
I would like to get the first 5 random entries out of my "mysql" database,
what would be the correct SELECT option?
I adjusted this line
$result = mysql_db_query ("$DBName","select * from Contacts LIMIT 0,5 ");
which works correctly. :)
$result = mysql_db_query ("$DBName","select * from Contacts order by rand()
LIMIT 5 ");
Doesn't work at all. :(
Can anyone through any light on this subject.
Thanks.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001