QuerySQL($sql); //$sql = "select {prefix}category.* from {prefix}category,{prefix}equipment where {prefix}category.id={prefix}equipment.category and {prefix}equipment.type='$dbtype' group by {prefix}category.id order by {prefix}category.name"; //$Categories = $DB->QuerySQL($sql); foreach ($Categories as $k=>$c){ if ($c["id"]==$category){ $sql = "select * from {prefix}equipment where {prefix}equipment.category=$category and {prefix}equipment.type='$dbtype' order by {prefix}equipment.name"; $equipment = $DB->QuerySQL($sql); foreach ($equipment as $k1=>$e){ $ext = ""; $basename = "equipment/thumb".$e["id"]; foreach ($image_extensions as $extension){ if (file_exists(BASEDIR.$basename.".".$extension)){ $ext = $extension; break; } } if ($ext==""){ $equipment[$k1]["thumb"] = "press-printing/spacer.gif"; } else { $equipment[$k1]["thumb"] = $basename.".".$ext; } } $Categories[$k]["Equipment"] = $equipment; } } include_once(TPL_DIR."equipment.php"); ?>