Re: Random not working?

From: Date: Sat, 01 Mar 2003 14:10:47 +0000
Subject: Re: Random not working?
Groups: php.db php.general 
Request: Send a blank email to php-db+get-26926@lists.php.net to get a copy of this message
There have been several recent inputs about this topic on the General Discussion list at mysql. http://lists.mysql.com/ As I recall, the answer was: Yes, it's broken in 3.23.xx and how to go about fixing it is under review. You might search their list archive for a complete picture. hth, Doug On Sat, 1 Mar 2003 12:24:57 +0100, Frank Keessen wrote: >Hi All, > >I'm trying to get a random record each time this script runs; Only it's giving me >everytime the first record back.. No random at all.. > >// generate and execute query >$query = "SELECT stedenid, naamstad, stadomschrijvk FROM steden ORDER BY RAND() LIMIT >1"; >$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); >$row = mysql_fetch_object($result); >echo $row->naamstad; > > >Version info; > >PHP 4.3.1 >Mysql 3.23.54 > >When i'm trying to excute the SELECT statement in phpmyadmin; i'm only getting the >first record back and when i'm taking off the LIMIT 1 it will display all the records in >ascending order so also not in random.. > > >Regards, > >Frank > > > > > >

« previous php.db (#26926) next »