techiefreak05 Posted March 30, 2007 Share Posted March 30, 2007 this might seem like a stupid question, i should be able to do this. but on the front page of my site i want a thing to show a few users. but i dont want it to show the same people over and over. i want it to select different people each time. any ideas? EDIT: I already have a script that shows a few users, but it shows the same ones , i just need to know how to select different users from the database each time. Link to comment https://forums.phpfreaks.com/topic/44953-solved-randomly-select-from-database/ Share on other sites More sharing options...
obsidian Posted March 30, 2007 Share Posted March 30, 2007 Run a forum search for ORDER BY RAND() or something similar, and you'll find a bunch of discussions of the most optimal way to do what you're after. In short, you can try this (for 5 random users): SELECT * FROM users ORDER BY RAND() LIMIT 5; Link to comment https://forums.phpfreaks.com/topic/44953-solved-randomly-select-from-database/#findComment-218250 Share on other sites More sharing options...
techiefreak05 Posted March 30, 2007 Author Share Posted March 30, 2007 Thanks! thats just what i wanted! Link to comment https://forums.phpfreaks.com/topic/44953-solved-randomly-select-from-database/#findComment-218263 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.