Erelid |
|
Hij weet niet welke dog_name te nemen.. dus je moet je query wijzigen:
SELECT te.team_id, u.user_name, d1.dog_name AS dog1_name, d2.dog_name AS dog2_name
FROM teams AS te
INNER JOIN users AS u ON te.user_id = u.user_id
INNER JOIN dogs AS d1 ON te.dog_id1 = d1.dog_id
INNER JOIN dogs AS d2 ON te.dog_id2 = d2.dog_id
SELECT te.team_id, u.user_name, d1.dog_name AS dog1_name, d2.dog_name AS dog2_name FROM teams AS te INNER JOIN users AS u ON te.user_id = u.user_id INNER JOIN dogs AS d1 ON te.dog_id1 = d1.dog_id INNER JOIN dogs AS d2 ON te.dog_id2 = d2.dog_id
Dus je hernoemt dog_name eerste keer naar dog1_name en 2de keer naar dog2_name - vervolgens werk je dan met $rows['dog1_name'] en dog2_name |