Re: Re: random data from mysql db

From: Date: Mon, 05 Aug 2002 09:23:31 +0000
Subject: Re: Re: random data from mysql db
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-111194@lists.php.net to get a copy of this message
With older versions of MySQL you had to do this: SELECT id, name, age, etc, id*0+RAND() as rand_col FROM table ORDER BY rand_col HTH, Peter Janett New Media One Web Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PostgreSQL coming soon! http://www.newmediaone.net webmaster@newmediaone.net (303)828-9882 ----- Original Message ----- From: "George Nicolae" <geomasterweb@hotmail.com> To: <php-general@lists.php.net> Sent: Monday, August 05, 2002 2:41 AM Subject: [PHP] Re: random data from mysql db > SELECT * FROM tablename ORDER BY RAND() LIMIT 1 > > -- > > > Best regards, > George Nicolae > IT Manager > ___________________ > PaginiWeb.com - Professional Web Design > www.PaginiWeb.com > > > "Tux" <tuxen@gimped.net> wrote in message > news:1028586495.12082.47.camel@tuxen.gimped.net... > > > > hey guys, > > > > what im trying to do is display a random entry from a mysql db, is there > > a function for this? or do i just have to generate a random number and > > go from there? > > > > jo > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#111194) next »