require_once("conn.php"); //get the category name $q1 = "select CategoryName from dd_categories where CategoryID = '$_GET[CategoryID]' "; $r1 = mysql_query($q1) or die(mysql_error()); $a1 = mysql_fetch_array($r1); $CategoryName = $a1[0]; $MainQuery = "select * from dd_items where ItemCategory = '$_GET[CategoryID]' and ItemStatus = 'approved' "; //get the subcategory name if(!empty($_GET[SubcategoryID])) { $q1 = "select SubcategoryName from dd_subcategories where SubcategoryID = '$_GET[SubcategoryID]' "; $r1 = mysql_query($q1) or die(mysql_error()); $a1 = mysql_fetch_array($r1); $CategoryName .= " / $a1[0]"; $MainQuery .= " and ItemSubcategory = '$_GET[SubcategoryID]' "; } $MainQuery .= " order by ItemTitle"; $NavQuery = $MainQuery; if(empty($_GET[Start])) { $Start = '0'; } else { $Start = $_GET[Start]; } $ByPage = "15"; $MainQuery2 = $MainQuery." limit $Start,$ByPage"; //get the listing $r100 = mysql_query($MainQuery2) or die(mysql_error()); if(mysql_num_rows($r100) > '0') { while($a100 = mysql_fetch_array($r100)) { $Item_Listing .= "
$a100[ItemTitle]$a100[ItemText] |
| "; $pages = ceil($rows/$ByPage); for($i = 0; $i <= ($pages); $i++) { $PageStart = $ByPage*$i; $i2 = $i + 1; if($PageStart == $Start) { $links[] = " $i2\n\t "; } elseif($PageStart < $rows) { $links[] = " $i2\n\t "; } } $links2 = implode(" | ", $links); $NextPrev .= $links2; $NextPrev .= "| | "; $NextPrev .= "