require_once("conn.php");
//get the item details
$q1 = "select * from dd_items where ItemID = '$_GET[ItemID]' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
//get the category
$q2 = "select CategoryName from dd_categories where CategoryID = '$a1[ItemCategory]' ";
$r2 = mysql_query($q2) or die(mysql_error());
$a2 = mysql_fetch_array($r2);
$Item_Category = $a2[0];
$ItemID = $a1[ItemID];
if($a1[ItemSubcategory] > '0')
{
//get the subcategory name
$q3 = "select SubcategoryName from dd_subcategories where SubcategoryID = '$a1[ItemSubcategory]' ";
$r3 = mysql_query($q3) or die(mysql_error());
$a3 = mysql_fetch_array($r3);
$Item_Category .= "/$a3[0]";
}
$Item_Contributor = $a1[Contributor];
//get the rating
$q4 = "select count(ItemID) as n, sum(Rating) as r from dd_rating where ItemID = '$a1[ItemID]' ";
$r4 = mysql_query($q4) or die(mysql_error());
$a4 = mysql_fetch_array($r4);
if($a4[n] > '0')
{
$Item_Rating = number_format($a4[r]/$a4[n], 2, ".", "");
}
else
{
$Item_Rating = "0.00";
}
$View_Item .= "$a1[ItemTitle]
";
$View_Link .= "
Open Worksheet - 打开工作表 |