I have users, who have friends that are also users in mysql database.
I have a foreign key for both users, so that I can reference their data
directly. My problem is displaying friends. My for statement would
look something like this:
for i in([email protected])
so @user is the user that i’m displaying friends for… .friends are the
entries that he is in… then .user are the users connected to him in
the database, and .name would be their name. But if a user has 200
friends then the for statement will loop through that statement 200
times and do 200 queries to grab the name. How can I grab all of the
usernames in one SQL statement utilizing my fk relationships?