Re: [PHP-DB] selecting records on a random basis with mysql function rand possible?

2002-05-07 Thread andy
cool! works. thanx, Andy "Jason Wong" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED]... > On Tuesday 07 May 2002 20:52, andy wrote: > > Hi there, > > > > is it possible to get mysql to return a record out of a table on a random > > basis? > > > > I tryed: > > > > select rand(

Re: [PHP-DB] selecting records on a random basis with mysql function rand possible?

2002-05-07 Thread andy
but how can I be sure that this id does exist? sure, I could count all records and than do a rand(0,$value); but there might be a better way in mysql directly. "Chris" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Why not just get a random number in

Re: [PHP-DB] selecting records on a random basis with mysql function rand possible?

2002-05-07 Thread Jason Wong
On Tuesday 07 May 2002 20:52, andy wrote: > Hi there, > > is it possible to get mysql to return a record out of a table on a random > basis? > > I tryed: > > select rand() ID, city > from data.cities > where country = 'CA' > LIMIT 1 > > but does not work though. Has anybody an idea? I tryed also t

Re: [PHP-DB] selecting records on a random basis with mysql function rand possible?

2002-05-07 Thread Chris
Why not just get a random number in PHP and do a select statement like that? IE SELECT ID, city FROM data.cities WHERE country = 'CA' and ID = rand() -Chris At 02:52 PM 5/7/2002 +0200, andy wrote: >Hi there, > >is it possible to get mysql to return a record out of a table on a random >basis?