Hi There,
Hope someone can help.
I need a little snippet of code that will display 5 random entries from a mysql database. I would also like a spacer between each display.
Many thanks
Paul
display 5 random entries from mysql with php
Moderator: General Moderators
-
madan koshti
- Forum Commoner
- Posts: 50
- Joined: Fri Jun 06, 2008 4:25 am
Re: display 5 random entries from mysql with php
Hi ,
This will select 5 rows randomly
select * from TABLE_NAME order by rand() limit 5
and random with spacer :
select concat(column1," ",column2," ",column3) as randomwithspace from TABLE_NAME order by rand()
This will select 5 rows randomly
select * from TABLE_NAME order by rand() limit 5
and random with spacer :
select concat(column1," ",column2," ",column3) as randomwithspace from TABLE_NAME order by rand()