Re: [PHP] Retrieve item from table at random

2001-02-07 Thread Steve Werby
"Ben Gollmer" <[EMAIL PROTECTED]> wrote: > I've got a better way yet: > > select RAND() as rand_col, column_name from table_name order by rand_col Ben, you must have overlooked David Robley's reply and my confirmation that his idea does indeed work (which was in the email you responded to). Davi

Re: [PHP] Retrieve item from table at random

2001-02-07 Thread Ben Gollmer
I've got a better way yet: select RAND() as rand_col, column_name from table_name order by rand_col Only one query for randomized results, no PHP/Perl/etc. You can of course add the 'limit 1' on the end to get one row back. I use this method a lot - my main server is running 3.22.32 but my tes

Re: [PHP] Retrieve item from table at random

2001-02-06 Thread Steve Werby
"David Robley" <[EMAIL PROTECTED]> wrote: > On Wed, 7 Feb 2001 11:28, enthalpy wrote: > > anyone have example code for randomly grabing an item from a mysql table? > > > > Mysql 3.23 will let you order by RAND() and you could use a LIMIT to > restrict to one result. I haven't tried it, though. I

Re: [PHP] Retrieve item from table at random

2001-02-06 Thread David Robley
On Wed, 7 Feb 2001 11:28, enthalpy wrote: > anyone have example code for randomly grabing an item from a mysql table? > Mysql 3.23 will let you order by RAND() and you could use a LIMIT to restrict to one result. I haven't tried it, though. -- David Robley| WEBMASTER &