I have two tables: COMMENTS and USERS. I save user's name on COMMENTS table, but user's avatar details should be taken from USERS table.
SELECT c.id, c.tarih, c.yorum, c.yorumcu,
(SELECT avatarID FROM USERS WHERE Username=c.yorumcu) AS avatarID
FROM COMMENTS c WHERE c.id = ?
The question mark at the end gets replaced with NEWS_ID. (e.g news.php?id=5)
I managed to code this, but it only gets the "last comment" details from database, not all of them. (Let's say 5 people commented on page, it only gets the last (5th) comment, ignoring the rest.)
Can anybody help me?
Ps. Yorumcu means "Commenter". COMMENTS.Commenter and USERS.Username are the same.