Просмотр файла dotwidgeta/showcatpicks.php

Размер файла: 1.59Kb
<?php


include("./admin/dotwidgeta_config.php"); 


include("./admin/connect_db.php"); 


$metatitle = $sitename . " - Category Picked";


include($file_path.$header_file);


include($file_path."includes/nav.inc"); 





$selectl = "SELECT DISTINCT articles.id as articleid, title, CID, JID, articles.description as descr"; 


$froml =   " FROM articles, article_lookup, article_cats";


$wherel =  " WHERE articles.id = JID AND CID = '$thiscat'";





$articles = mysql_query($selectl . $froml . $wherel);


if (!$articles) {


  echo("<P>Error retrieving categories from lookup table!<BR>".


	   "Error: " . mysql_error());


  exit();


}





// grab category name


$selectc = "SELECT name "; 


$fromc =   " FROM article_cats";


$wherec =  " WHERE id = '$thiscat'";





$categories = mysql_query($selectc . $fromc . $wherec);


if (!$categories) {


  echo("<P>Error retrieving categories from categories table!<BR>".


	   "Error: " . mysql_error());


  exit();


}





 while ($category = mysql_fetch_array($categories)) {


   $cat_name  = $category["name"];


//  echo("<p><b><a href=\"showarticle.php?id=".$articleid."\">$title</a></b><br>$descr ");  


 }





echo("Category: <b>" . $cat_name . "</b>"); 





while ($article = mysql_fetch_array($articles)) {


  $jid  = $article["JID"];


  $title = $article["title"];


  $articleid = $article["articleid"];


  $cid = $article["CID"];


  $descr = $article["descr"];


  echo("<p><b><a href=\"showarticle.php?id=".$articleid."\">$title</a></b><br>$descr ");  


}





include($file_path.$footer_file);





?>