Re: Random Row From Database

From: Date: Sun, 11 Nov 2001 08:42:44 +0000
Subject: Re: Random Row From Database
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-74157@lists.php.net to get a copy of this message
On Sunday 11 November 2001 05:18, HEW Staff wrote: > Hi, > > I'm trying to pull a random row from my database and display the > contents. > > I know that the code: > SELECT * FROM TABLENAME WHERE RAND() LIMIT 1 > should work. (1) php-dev@php.net has nothing to do with this. So don't crosspost to there. (2) No, it shouldn't work "WHERE RAND ()" means "where some random number evaluates to true (i.e. is nonzero)" you want "ORDER BY RAND () LIMIT 1" -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) ..10001000110101011010101101011110111010113...????

« previous php.general (#74157) next »