Re: [PHP] random row

2005-11-15 Thread Curt Zirzow
On Wed, Nov 16, 2005 at 05:19:52PM +1300, Jasper Bryant-Greene wrote: > John Taylor-Johnston wrote: > >My question is simnple. I want to randomly select a row in a mysql > >table. I have a primary id. > > > > >$server = "localhost"; > >$user = "foo"; > >$pass = "foo"; > >$db="foo_db"; > >$table="f

Re: [PHP] random row

2005-11-15 Thread Jasper Bryant-Greene
John Taylor-Johnston wrote: My question is simnple. I want to randomly select a row in a mysql table. I have a primary id. $news = mysql_query($sql) or die(print "color=red>".mysql_error().""); while ($mydata = mysql_fetch_object($news)) { ?? } ?> If your table isn't too big, it's

Re: [PHP] Random Row...

2003-01-16 Thread Danny Shepherd
Don't make life difficult for yourself :) SELECT * FROM myTable ORDER BY RAND() LIMIT 0,1 HTH Danny. - Original Message - From: "Brian McGarvie" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 16, 2003 9:37 AM Subject: [PHP] Random Row... > $sql = " > select c

Re: [PHP] Random Row From Database

2001-11-11 Thread Christian Reiniger
On Sunday 11 November 2001 05:18, HEW Staff wrote: > Hi, > > I'm trying to pull a random row from my database and display the > contents. > > I know that the code: > SELECT * FROM TABLENAME WHERE RAND() LIMIT 1 > should work. (1) [EMAIL PROTECTED] has nothing to do with this. So don't crosspost t