Sure, here's the code for class articles. Two of the functions in there (showQuickArticles and showRecentArticles) are basically the same function except some minor differences. I wasn't sure how to achieve what I wanted by using one function, so I used two. Anyway, here's the code:
class articles
{
var $id = '';
var $category = '';
var $title = '';
var $author = '';
var $article = '';
var $row = NULL;
function showFullArticle()
{
if($_GET['articleid'] == '')
{
echo("<p><b>Current articles:</b></p>");
$articles = new articles();
$articles->showQuickArticles();
echo("</p>");
} else {
if($_GET['articleid'] == '$this->id')
{
$this->id = $_GET['articleid'];
$connection = new mysqlConnection();
$connection->connect();
$getArticle = $connection->query("SELECT * FROM articles WHERE `articleid` = '$this->id'");
$this->row = mysql_fetch_array($getArticle);
$this->title = $this->row['title'];
echo($this->title);
}
}
}
function showQuickArticles()
{
$connection = new mysqlConnection();
$connection->connect();
$getArticles = $connection->query("SELECT articleid,title,author,date FROM articles ORDER BY date,title,author ASC");
while($this->row = mysql_fetch_array($getArticles))
{
$this->id = $this->row['articleid'];
$this->title = $this->row['title'];
$this->author = $this->row['author'];
echo("<b><a href='articles.php?articleid=$this->id'>$this->title</a></b> ... by $this->author<br />");
}
}
function showRecentArticles()
{
$connection = new mysqlConnection();
$connection->connect();
$getArticles = $connection->query("SELECT title,author,date FROM articles ORDER BY date,title,author ASC LIMIT 5");
while($this->row = mysql_fetch_array($getArticles))
{
$this->title = $this->row['title'];
$this->author = $this->row['author'];
echo("<b>$this->title</b> ... by $this->author<br />");
}
}
}