I'm only going to answer question 3, as q1 is already answered and I don't know enough PHP to answer the second one.
I looked at your tables and it seems to me that the ArticleLookup table is in fact obsolete. You'd better add AID and CID to the Article table, this would make it easier to search. The query to find the last 20 articles by an author, where the lastname of the author is stored in $author could be like this:
Code:
//connect to your db
$db = mysql_connect("myhost", "username", "password");
mysql_select_db("mydb", $db);
//this statement selects the AID from lastname stored in $author
$sql="SELECT id FROM Authors WHERE Lastname=$author";
$result=mysql_select($sql, $db);
$auth_id=($result, 0, "id");
$auth_firstname=($result, 0, "Firstname");
//this statement selects the last 20 articles from an author and sorts them by last PostDate first
$sql="SELECT * FROM Articles WHERE AID=$auth_id ORDER by PostDate DESCENDING LIMIT 20";
$result=mysql_select($sql, $db);
//use this loop to show the articles
where ($row=mysql_fetch_array($result))
{ //do this to put the Article category in $category, so you can show that too
$sql="SELECT * FROM Categories WHERE id=$row["CID"];
$result2=mysql_select($sql, $db);
$category=($result, 0, "CatName");
and then show the all info here
};
I haven't tested it, but I think this should work. I'm sure there is a more elegant way to do this, but I'll leave that to someone else ;-).
Bookmarks