Chapter 16 forum - SQL error
I've got a copy of Beginning PHP5, Apache, and MySQL Web Development.
I've been working through Chapter 16 and get this error when loading the index page:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mod FROM forum_forum f LEFT JOIN forum_posts p ON f.id = p.forum_id AND ' at line 3
Here is the offending bit of code:
$sql = <<<EOS
SELECT f.id as id, f.forum_name as forum,
f.forum_desc as description,
count(forum_id) as threads, u.name as mod
FROM forum_forum f
LEFT JOIN forum_posts p
ON f.id = p.forum_id
LEFT JOIN forum_users u
ON f.forum_moderator = u.id
GROUP BY f.id,
Somone on another forum suggested I added "f.forum_name, f.forum_desc, u.name" on the end of the group by statement. I've tried this and it doesn't work.
Can anyone help????