> -----Original Message----- > From: Mike Shanley [mailto:thebarmy@xxxxxxxxxxxxxxxxx] > Sent: Monday, February 19, 2007 3:50 PM > Cc: php-general@xxxxxxxxxxxxx > Subject: Re: WHERE problem > > Without the single-quotes, I still get nothing returned. > > Bruce Cowin wrote: > > Are you getting an error or just nothing returned? The first thing I'd > check is if index is a numeric field and if it is, remove the single > quotes from around $randi in the where clause. > > Two things that come to mind... 1) If there are 100 records in there, is the value of the 'index' column exactly 1-100? It won't do any good to give it a random value of 1-100 if your records are numbered 101-200 :P 2) INDEX is a mysql keyword. Try putting backticks around it. "... WHERE `index` = $randi" If all else fails, remove the part of your code that generates the random 'index' and just use "ORDER BY RAND() LIMIT 1" in your query. HTH, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php