The only way you can return CategoryName without accesing tblcategory is to move that field into tblArticle.
However this destroys the whole purpose of having seperated it into another table in the first place, and assuming that you have created two tables due to a one to many or many to many relationship will result in a lot of data duplication.
The query you need will access both tables at the same time:
SELECT A.ArticleContent, C.CategoryName
FROM tblArticle A, tblcategory C
WHERE A.CategoryID(FK) = C.CategoryID(FK);
When this is returned in PHP you reference the resultset with out the post fix i.e.
$row['ArticleContent'];
$row['CategoryName'];
Mr B
P.S. in the SQL you can replace the A and the C with anything you like as long as it is the same throughout the query.
Last edited by Brooksie155; 02-10-2006 at 04:47 AM.
Bookmarks