Re: need help displaying random records

From: Date: Tue, 01 May 2001 02:30:41 +0000
Subject: Re: need help displaying random records
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-7174@lists.php.net to get a copy of this message
On 30 Apr 2001 17:27:44 -0700, r.gelstharp <r.gelstharp@ntlworld.com> wrote: > As a university degree student my final year project is a comparison on ASP > v PHP. I have to make two identical sites in both languages, but am at the > moment having trouble duplicating a function on my ASP pages in PHP. > > The default page in my ASP pages display random records from the database to > the screen, but I'm having a bugger of a time trying to duplicate the effort > in PHP. Which database are you using? If you don't have an easy database (e.g. records from 1 to 100 allowing a simple select where ID=rand()), you'll probably need something database specific - for example, in SQL Server you should be able to do SELECT TOP 1 ... ORDER BY RAND(). Alternately, if you only have a small number of records, you could simply select all of the records and then pick a row from the resultset at random. Chris

« previous php.windows (#7174) next »