southbeach
Programmer
The subject line sounds too complicated for what follows:
PROBLEM:
I have two tables (articles and authors). I use the articles table for both articles and their respective responses. As of today, I have lived with the flaw that if a guest leaves a reply or submits an article, this will not appear since my query does not find an author to match the author in the articles table.
Here is the query I am using:
As you can see, the query will only return rows for those cases where the author is known. When adding a new article, I am defaulting the author ID to 0 if not logged in thus causing this problem.
WHAT I SEEK
I need a query I can use to select all as above and for those where no matching author is found, I would like to set a variable (something line author_name) to GUEST.
Thank you all in advance for your help!
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
PROBLEM:
I have two tables (articles and authors). I use the articles table for both articles and their respective responses. As of today, I have lived with the flaw that if a guest leaves a reply or submits an article, this will not appear since my query does not find an author to match the author in the articles table.
Here is the query I am using:
Code:
SELECT a.* , b.MemberFirstName , b.MemberLastName, c.Category from articles a , members b , categories c WHERE a.ParentID <= 0 AND a.AuthorID = b.MemberID AND a.CatID = c.CatID LIMIT ' . $start . ", " . $limit;
As you can see, the query will only return rows for those cases where the author is known. When adding a new article, I am defaulting the author ID to 0 if not logged in thus causing this problem.
WHAT I SEEK
I need a query I can use to select all as above and for those where no matching author is found, I would like to set a variable (something line author_name) to GUEST.
Thank you all in advance for your help!
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.