");
}
//######################If URL contains article id then....
if(isset($_GET['article'])){
//Get all values
$id = $_GET['article']; //article id
$query = mysql_query("SELECT * FROM `guides` WHERE `id` = $id");//Find article Id in databse
$row = mysql_fetch_array($query);
$title = $row["title"];//Article title
$body = $row["body"];//Article body
$desc = $row["desc"];//Article description
$keywords = $row["keywords"];//Article keywords
$link = $row["link"];//Article link
$user = $row["user"];//Article author
$cat = $row["cat"];//Article category
$rcount = $row["rcount"];// number of votes cast
$rtotal = $row["rtotal"];//Total rating
if($rcount == "0"){
//If no votes cast
$rating = $art_novotes;
}else{
//If votes cast
$rating = $rtotal / $rcount; //Divide
$rating = round($rating,1); //Round to 1 digit after decimal
}
$views = $row["views"];//Total views
//If category heirarchy is on
if($category_nav_on == 1){
echo("");
}
//Print out main body
echo $art_body;
//Voting feature if on
if($voting_on == 1){
echo $art_vote;
}
//Update total views
mysql_query("UPDATE `guides` SET `views` = `views` + 1 WHERE `id` = '$id'");
//#############################Show all articles in this category
}elseif(isset($_GET['cat'])){
//Retreive category title
$category = $_GET['cat'];
//Find all guides in this category
$query = mysql_query("SELECT * FROM `guides` WHERE `validated` = 1 AND `cat` = '$category'");
//Category heirarchy
if($category_nav_on){
echo ("");
}
//Start the table
echo $cat_init_table;
while ($row = mysql_fetch_array($query)) {
//Check if alternate colors on
if($list_alt_colors == 1){
$cc+=1;
if($cc % 2 == 0 ){
$col = "alt1";
}else{
$col = "alt2";
}
}else{
$col = "alt1";
}
//Get all values
$id = $row["id"];
$title = $row["title"];
$body = $row["body"];
$desc = $row["desc"];
$keywords = $row["keywords"];
$link = $row["link"];
$user = $row["user"];
$cat = $row["cat"];
$rcount = $row["rcount"];
$rtotal = $row["rtotal"];
$views = $row["views"];
//List all guides that fit under this category
echo $cat_art_list;
}
//close table
echo ("");
//#################################Search feature
}elseif(isset($_POST['search'])){
//Read in keyword(s) searched
$word = $_POST['search'];
//Find in db - if it fits more than 50% of total guides, then doesnt show anything
$query = mysql_query("SELECT *
FROM guides
WHERE MATCH (
`body` , `desc` , `keywords`
)
AGAINST (
'$word'
)");
//If turned on, show category heirarchy
if($category_nav_on == 1){
echo "";
}
//Create table beginning
echo $sea_init_table;
while ($row = mysql_fetch_array($query)) {
//Check if alternate colors on
if($list_alt_colors == 1){
$cc+=1;
if($cc % 2 == 0 ){
$col = "alt1";
}else{
$col = "alt2";
}
}else{
$col = "alt1";
}
//Read in all data
$id = $row["id"];
$title = $row["title"];
$body = $row["body"];
$desc = $row["desc"];
$keywords = $row["keywords"];
$link = $row["link"];
$user = $row["user"];
$cat = $row["cat"];
$rcount = $row["rcount"];
$rtotal = $row["rtotal"];
$views = $row["views"];
//List all articles that match
echo $sea_art_list;
}
echo ("");
//##############################No article id set - showing list of guides
}elseif(!isset($_GET['article'])){
echo "testing";
$query = mysql_query("SELECT * FROM `guides` WHERE `validated` = 1");
//If turned on - show category heirarchy
if($category_nav_on == 1){
echo "";
}
//Begin the table
echo $ini_main_table;
while ($row = mysql_fetch_array($query)) {
//Check if alternate colors on
if($list_alt_colors == 1){
$cc+=1;
if($cc % 2 == 0 ){
$col = "alt1";
}else{
$col = "alt2";
}
}else{
$col = "alt1";
}
//Read in all values
$id = $row["id"];
$title = $row['title'];
$body = $row["body"];
$desc = $row["desc"];
$keywords = $row["keywords"];
$link = $row["link"];
$user = $row["user"];
$cat = $row["cat"];
$rcount = $row["rcount"];
$rtotal = $row["rtotal"];
$views = $row["views"];
//Print out main table
print $main_table;
}
//Close table
echo ("");
}
include('footer.php');
?>