I have this query:
$sql = "SELECT
u.new_userid
, u.fname
, u.lname
, u.email
FROM users u
INNER JOIN club_users cu
ON cu.new_userid = u.new_userid
INNER JOIN
(SELECT
clubid
FROM club_users
WHERE new_userid = $userid
) AS c
ON c.clubid = cu.clubid
WHERE u.new_userid <> $userid";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
echo $row['fname'].' '.$row['lname'].'<br>';
}
Now, this prints out all the users the current user is connected to in the clubs the current user is a member of and as is works perfect, but...
I also wants to print out the clubs the current user is a member of along side the users... So if this current user is a member of 2 clubs those 2 club(names) would come in the same loop/array... How do I go about that...
The dbtable with the club information is called:
clubs with 2 fields... clubid and clubname.
Hope somebody can see the light...