Lol I believe you.
Ok, so I want to get all threads that have a post count greater than the post count recorded in the cookie.
Now, a cookie like this:
Code: Select all
array(
131 => 20,
100 => 10,
111 => 15
);
Will mean the user has seen threads 131 with 20 posts, 100 with 10, and 111 with 15.
My current sql is somethign like this: (dumbed down version)
Code: Select all
SELECT F.*, COUNT(P.`ID`) AS `PostCount`
FROM `Forum` F
INNER JOIN `Forum` P ON P.`Thread`=F.`ID`
GROUP BY F.`ID`
ORDER BY F.`ID` DESC
I need to some how only retrieve threads with `PostCount` greater than whatever their post count is in the cookie...
So for example,
Code: Select all
SELECT F.*, COUNT(P.`ID`) AS `PostCount`
FROM `Forum` F
INNER JOIN `Forum` P ON P.`Thread`=F.`ID`
WHERE `ID`=111
GROUP BY F.`ID`
HAVING `PostCount`>{$forum_data[111]}
ORDER BY F.`ID` DESC
Would suffice for one thread (with ID 111), as in, it would return the thread if it has new replies, but I need to do this for all threads...It's confusing the hell out of me.