I'm very far into writing a forum when it occurred to the team to allow Guest posting. Guests don't have an entry in the table members, so the following query does not return their posts:
SELECT
p.Emoticons, p.Code, p.Time, p.Post, p.PStarter, p.PID, p.Post_IP,
m.Joined, m.Signature, m.Posts, m.UID, m.MemTitle, m.MemberGroup, m.Avatar
FROM
posts p, members m
WHERE
p.Topic='$t' AND
p.Forum='$f' AND
m.Name=p.PStarter
ORDER BY
p.Time
LIMIT $min, $n
$t is the topic ID, $f is the forum ID, $min is the first post to display, $n is the number of posts to display.
The query doesn't return Guest posts because of m.Name=p.PStarter, in the WHERE clause. How can I change this query to only get from the members table when PStarter is not Guest?