I've build the following query
$subforumsquery = "
SELECT
forums.*,
posts.title AS lastmsgtitle,
posts.timee AS lastmsgtime,
posts.useraid AS lastmsguseraid,
posts.useradn AS lastmsguseradn,
users.photo AS lastmsgphoto
FROM forums
LEFT JOIN posts
ON (posts.forumid = forums.id)
LEFT JOIN users
ON (posts.useraid = users.id)
WHERE forums.relatedto = '$forumid'
and posts.type = 'post'
ORDER BY `id` DESC";
I don't know why, but i get the same subforum twice even that there is only 1 sub forum.
BTW, is there any way to select only the last post insted of searching all?
Thanks!
DESCRIBE mytableorSHOW CREATE TABLE mytable