Re: Random Row...

From: Date: Thu, 16 Jan 2003 10:05:19 +0000
Subject: Re: Random Row...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131835@lists.php.net to get a copy of this message
Don't make life difficult for yourself :) SELECT * FROM myTable ORDER BY RAND() LIMIT 0,1 HTH Danny. ----- Original Message ----- From: "Brian McGarvie" <brian.mcgarvie@anypurposeloans.co.uk> To: <php-general@lists.php.net> Sent: Thursday, January 16, 2003 9:37 AM Subject: [PHP] Random Row... > $sql = " > select count(*) as theCount > from myTable > "; > ... > $row_id = rand(1, $myrow["theCount"]); > ... > $sql_randow_row " > select * > from myTable > where id = $row_id > "; > > I assume I'm right with the method above to select a random row? or any > other way? >

« previous php.general (#131835) next »