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.. 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 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 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
Archived
This topic is now archived and is closed to further replies.