We help IT Professionals succeed at work.

Need SQL syntax help to call up & display multiple-random records in PHP?

evibesmusic
evibesmusic asked
on
216 Views
Last Modified: 2013-12-12
Hello Experts,

I have a community site (written in PHP) in which I would like to display the profile picture and username of MULTIPLE yet RANDOM members.

I have successfully been able to call up the random profile picture and username of a member using the following SQL query syntax:  mysql_query('SELECT * FROM members ORDER BY RAND() LIMIT 1')

But, as someone with more SQL experiance that I can see, this code only allows for one record to be randomly pulled and displayed from the data table 'members'.

I want to randomly pull two or three or even more records radomly.  I just can't figure out the SQL syntax.

Can someone help me out?  I think that what I am asking to do can be accomplished via the SQL syntax issue but, if you have a better way to skin this cat, I am all ears.

I love this site and thank you so much for just being here!  You guys are great!

EVibesMusic
Comment
Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you...nice work.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.