DarkHorizon Posted October 3, 2005 Share Posted October 3, 2005 If i have a mysql database with 10 items in it. How do i display any 3 at random? Every time the front page loads on my website i need 3 random products to appear. I know how to display and sort databases, its the statement to retrieve a random items that is confusing me.. cheers guys.. Quote Link to comment https://forums.phpfreaks.com/topic/2600-displaying-random-records-from-database/ Share on other sites More sharing options...
Cook Posted October 3, 2005 Share Posted October 3, 2005 SELECT * FROM `table` ORDER BY RAND() LIMIT 3 Quote Link to comment https://forums.phpfreaks.com/topic/2600-displaying-random-records-from-database/#findComment-8612 Share on other sites More sharing options...
DarkHorizon Posted October 4, 2005 Author Share Posted October 4, 2005 SELECT * FROM `table` ORDER BY RAND() LIMIT 3 302251[/snapback] cheers mate, i'll give that a try Quote Link to comment https://forums.phpfreaks.com/topic/2600-displaying-random-records-from-database/#findComment-8635 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.