$page_title"; //start new items page $content .= "
"; $content .= ""; $content .= "
Body or Chassis : Text Search :
Match

"; if (!isset($action)) { $content .= "Enter search conditions in the form above to find items.
\n"; } if ($action == "Search for Parts") { $query = "SELECT * FROM schoolbusequipment"; if (($borc != "-- Choose --") && ($borc)) $clause[] = "borc = '$borc'"; if (($cat_type != "-- Choose --") && ($cat_type)) $clause[] = "cat_type = '$cat_type'"; if (($part_type != "-- Choose --") && ($part_type)) $clause[] = "part_type = '$part_type'"; if (($body_make != "-- Choose --") && ($body_make)) $clause[] = "body_make = '$body_make'"; if (($part_num != "") && ($part_num)) $clause[] = "part_num LIKE '%$part_num%'"; if ($search != "") { $s_clause[] = "cat_type LIKE '%$search%'"; $s_clause[] = "part_type LIKE '%$search%'"; $s_clause[] = "part_description LIKE '%$search%'"; $clause[] = "(" . implode(" OR ",$s_clause) . ")"; } if ($clause) { if ($match == "any") $join = " OR "; else $join = " AND "; $query .= " WHERE " . implode($join,$clause); } $result = mysql_query($query) or die(mysql_error()); $num = mysql_num_rows($result); if (!isset($start)) $start = 0; $limit = 10; $begin = $start + 1; $end = $start + $limit; if ($end > $num) $end = $num; if ($num > $limit) { $query .= " ORDER BY cat_type,part_type,part_num LIMIT $start,$limit"; $result = mysql_query($query) or die(mysql_error()); } if (!$num) { $content .= "No results were found for your search conditions.
\n"; } else { $content .= ""; $content .= "\n"; $content .= "\n"; while ($row = mysql_fetch_array($result)) { $content .= "\n\n"; $content .= "\n"; $content .= "\n"; $content .= ""; $content .= "\n"; } $content .= ""; $content .= "
Showing items $begin to $end of $num
Category TypePart TypePart Number 
$row[cat_type]$row[part_type]$row[part_num]Details
Page : "; $pagecounter = 1; for ($i=0;$i<$num;$i+=$limit) { if ($i == $start) { $content .= "[" . $pagecounter . "] "; } else { $content .= "[" . $pagecounter . "] "; } $pagecounter++; } $content .= "
"; } } $text_links = implode("",file("text_links.inc")); $footer = implode("",file("footer.inc")); $query = "SELECT DISTINCT(borc) FROM schoolbusequipment ORDER BY borc"; $result = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result) != 0) { while($row = mysql_fetch_array($result)) { $product_nav .= "

$row[borc] PARTS

\n"; $query2 = "SELECT DISTINCT(cat_type) FROM schoolbusequipment WHERE borc = '$row[borc]' ORDER BY cat_type"; $result2 = mysql_query($query2); if (mysql_num_rows($result2) != 0) { while($row2 = mysql_fetch_array($result2)) { if (($borc == $row["borc"]) && ($cat_type == $row2["cat_type"])) { $product_nav .= "
$row2[cat_type]
\n"; } else { $product_nav .= ""; $product_nav .= "$row2[cat_type]\n"; } } } } } $page = new html_template("template.htm"); $page->set_parameter("PAGE_TITLE", $page_title); // Set the page title. $page->set_parameter("PAGE_CONTENT", $content); // Set the main content. $page->set_parameter("PRODUCT_NAV", $product_nav); // Set the main content. $page->set_parameter("TEXT_LINKS", $text_links); // Set the text links. $page->set_parameter("PAGE_FOOTER", $footer); // Set the footer content. $page->create_page(); // Send the page to the browser. ?>