OK for example, I have a query:
SELECT * FROM news WHERE cat='$cat' LIMIT 5;
The thing is, I want to select 5 random entries. Is that possible?
[SOLVED] Selecting random "n" entries from a DB
Moderator: General Moderators
try this
Code: Select all
SELECT * FROM news WHERE cat='$cat' ORDER BY rand() LIMIT 5;