connect("sophia"); ?> ETS Equipment Database "; } ?>
"; echo ""; for ($a = 0; $a < $buildingRows; $a++) { $building = mysql_result($buildingResult, $a, "building"); echo ""; } echo ""; ?>
 



You searched for everything everywhere"; } else { $searchMessage = "
You searched for "; } // Searching for a building if ($building != "none") { $searchQuery .= "AND building LIKE '%".$building."%'"; $searchMessage .= "Building: ".$building.""; } // Room if ($room != "none") { $searchQuery .= " AND room = '".$room."'"; $searchMessage .= " Room: ".$room.""; } // Searching for equipment if ($searchEquipment != "none") { $searchQuery .= " AND name LIKE '%".$searchEquipment."%'"; $searchMessage .= " Equipment: ".$searchEquipment.""; } // For a lifetime listing if (isset($_POST['lifetimeList'])) { $lifeMonth = $_POST['lifeMonth']; $lifeDay = $_POST['lifeDay']; $lifeYear = $_POST['lifeYear']; echo "
Listing the equipment in which the lifetime has run out as of $lifeMonth–$lifeDay–$lifeYear
"; $lifeView = mktime(0, 0, 0, $lifeMonth, $lifeDay, $lifeYear); $searchQuery .= " AND lifetime < $lifeView"; } // For a warranty listing if (isset($_POST['warrantyList'])) { $warrantyMonth = $_POST['warrantyMonth']; $warrantyDay = $_POST['warrantyDay']; $warrantyYear = $_POST['warrantyYear']; echo "
Listing the equipment in which the warranty has run out as of $warrantyMonth–$warrantyDay–$warrantyYear
"; $warrantyView = mktime(0, 0, 0, $warrantyMonth, $warrantyDay, $warrantyYear); $searchQuery .= " AND warranty_expiration < $warrantyView"; } // Order the results $searchQuery .= " ORDER BY b.building, (b.room + 0), b.room"; $searchResult = mysql_query($searchQuery); if ($searchResult) { // The search worked // Number of results $searchNum = @mysql_numrows($searchResult); if ($searchNum == 0) { // There were no results $searchMessage .= "

There were no results for your search.
"; echo $searchMessage; } else { // The search worked, and there were results $searchMessage .= "

You had ".$searchNum." results."; echo $searchMessage; // Colors for the table $colors = array("#EFFFA6", "#D6E1A5"); $colorIncrement = 0; ?>
"; } else { echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; if ($colorIncrement >= 2) { $colorIncrement = 0; } } echo "
Location Room Capacity Name Bulb Type Bulb Time Comments
"; echo " "; echo "".$building." ".$room."".$capacity."".$name."".$bulbType."".$bulbTime."".$comments."
"; } } else { // The search didn't work echo "
The search encountered a problem! Contact Damon at dblanche@email.smith.edu or x2953 right now!
"; } } //-------------------------------------------------------------- // The view full details button if (isset($_POST['viewFull_x'])) { $fullID = $_POST['workID']; // The other data (for going back) $building = $_POST['building']; $searchEquipment = $_POST['searchEquipment']; // Create the beginning of the search query // This is the full query $viewQuery = "SELECT a.*, b.building, b.room, b.capacity FROM equipment_details a, equipment_locations b WHERE a.roomID = b.id AND a.id = ".$fullID; echo "
View full entry.
"; $viewResult = mysql_query($viewQuery); if ($viewResult) { // The search worked // Colors for the table $colors = array("#EFFFA6", "#D6E1A5"); ?>
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
ID Location Room Capacity Name Brand Model Serial # Remote Installation Date Lifetime Warranty Expiration Bulb Type Bulb Time IP Vendor Comments
"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if (isset($_POST['lifetimeList'])) { echo ""; echo ""; echo ""; echo ""; } if (isset($_POST['warrantyList'])) { echo ""; echo ""; echo ""; echo ""; } echo "   "; echo "   "; echo ""; echo "
"; echo "
".$id."".$building." ".$room."".$capacity."".$name."".$brand."".$model."".$serial."".$remoteSerial."".date("n-j-y", $installDay)."".$lifetime." Years".date("n-j-y", $expireDay)."".$bulbType."".$bulbTime."".$ip."".$vendor."".$comments."
"; } else { // The search didn't work echo "
Full view encountered a problem! Contact Damon at dblanche@email.smith.edu or x2953 right now!
"; } } //--------------------------------------------------- // Close the connection to the database and close the html $connection->close(); ?>