Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
09-13-2005, 10:32 AM #1
- Join Date
- Jun 2004
- Los Angeles, CA
- Thanked 0 Times in 0 Posts
random selection out of MySQL results
I'm trying to do a random selection out of a MySQL query with a specific conditional. Example: I have a table that has an item id and the price for each item. I query for all items over a certain price and it returns a series of ids that fit that criteria. Then I need to randomly choose from these returned ids in order to display a random item with that criteria. Any methods or suggestions on how to specifically implement this would be greatly appreciated!
09-13-2005, 11:15 AM #2
mysql_query("SELECT product FROM table WHERE id='id_number' ORDER BY RAND() LIMIT 1")
Give that a try