I have a problem selecting 6 random friends
This is the query I\'ve got so far:
$result = num_rows(\"SELECT * FROM friends WHERE member_id = \'\".$_S
Instead of SELECT * at the beginning, try SELECT COUNT(*) and use the actual return value instead of num_rows().
SELECT *
SELECT COUNT(*)
Your loop could generate duplicates. I would suggest trying OMG Ponies answer.
There is a whole chapter about random selection in the book SQL Antipatterns.