PHP Code:
<?php
$link = mysql_connect("localhost", "kez", "pwd")
or die("Could not connect : " . mysql_error());
mysql_select_db("kez") or die("Could not select database");
$result = mysql_query("SELECT id,title,author,date,category,explanation FROM `tutorials` WHERE category='photoshop' ORDER BY title ASC", $link);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<a href=\"read_article.php?id=" . $line['id'] . "&category=" . $line['category'] . "\">" . $line['title'] . "</a> by " . $line['author'] . ", posted on the: " . $line['date'] . "<br><blockquote>" . $line['explanation'] . "</blockquote>";
}
mysql_close();
?>
That's the first file which shows you the titles of each row and a snippet with the author and date.
PHP Code:
<?php
ini_set("include_path", "/home/kez/public_html/");
if (!is_null($id)) {
$link = mysql_connect("localhost", "kez", "pwd") OR DIE("Avast! Cant connect to mysql DB yarrr!");
mysql_select_db("kez");
$result = mysql_query("SELECT * FROM `atr` WHERE ID='$id' LIMIT 0,1", $link);
$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo "<B>" . $line['title'] . "</B> By " . $line['author'] . " (" . $line['date'] . ")
<P>" . $line['content'] . "</P>";
} else {
echo "Ambigous request you n00b";
}
?>
That's the read_article file which displays all the results within the table
This is the method i'm using at the moment. This was when the tutorials, articles and reviews were all seperate tables. Now they are all combined and have a field called "section" to define what data should be displayed