"; echo ""; echo ""; echo ""; while($row != null) { echo ""; for($i = 1; $i < sizeOf($row); $i++) { echo ""; } echo ""; echo ""; $row = mysql_fetch_row($results); } echo ""; echo "
TypeQuantityPriceLineExpiration DateSpeciesCollection DateTimestamp
" . $row[$i] . "See Item
"; } #search each database for the input parameters if($_POST['category'] == "all") { if(isset($_GET['search'])) $search_param = $_GET['search']; if(isset($_POST['search'])) $search_param = $_POST['search']; $some_results = false; $item_ids; mysql_connect("floret.cgrb.oregonstate.edu","lab-inventory-user","lab-inventory-user_pw"); mysql_select_db("lab_inventory"); $date_search = ""; if(isset($_POST['from_date']) && isset($_POST['to_date']) && $_POST['from_date']!="" && $_POST['to_date']!="") { $date_search = "(time_stamp between '" . $_POST['from_date'] . " 00:00:00' and '" . $_POST['to_date'] . " 23:59:59')"; } #if no search query was entered, then search only by date $match_against = ""; if($search_param != "") { $match_against = "(match(type,line,species) against ('$search_param'))"; } $and = ""; if($date_search!= "" && $match_against != "") $and = "AND"; $query = "select * from item where $match_against $and $date_search"; $results = mysql_query($query); $row = mysql_fetch_row($results); if($row != null) { $some_results = true; echo "

Your query matched the following items:

"; echo ""; echo ""; echo ""; while($row != null) { echo ""; for($i = 1; $i < sizeOf($row); $i++) { echo ""; } echo ""; echo ""; $row = mysql_fetch_row($results); } echo ""; echo "
TypeQuantityPriceLineExpiration DateSpeciesCollection DateTimestamp
" . $row[$i] . "See Item
"; } $query = "select * from notes where match(note,curator) against('$search_param')"; $results = mysql_query($query); $row = mysql_fetch_row($results); if($row != null) { $some_results = true; echo "
Your query matched the following notes:
"; echo ""; echo ""; while($row != null) { echo ""; for($i = 1; $i < sizeOf($row); $i++) { echo ""; } echo ""; echo ""; $row = mysql_fetch_row($results); } echo "

Note

Curator

Date

" . $row[$i] . "See Item
"; } $query = "select * from meta where match(msds_link,warranty_info,service,manufacturer) against('$search_param')"; $results = mysql_query($query); $row = mysql_fetch_row($results); if($row != null) { $some_results = true; echo "
Your query matched the following meta information:
"; echo ""; echo ""; echo ""; while($row != null) { for($i = 1; $i < sizeOf($row); $i++) { echo $row[$i] . "\t"; } echo "See Item"; echo "
"; $row = mysql_fetch_row($results); } echo ""; echo "

MSDS Link

Warranty Info

Service

Manufacturer

"; } if($some_results==false) { echo "

Sorry, your query found no results!

"; } } else { $table; $param = $_POST['search']; $additive = ""; $category = $_POST['category']; $curator_categories = array("name","email"); $location_categories = array("building/room","freezer","shelf","cupboard"); $item_categories = array("type","quantity","price","collection date","expiration date","species","line"); if(in_array($category,$item_categories)) { $table = "item"; if(isset($_POST['from_date']) && isset($_POST['to_date']) && $_POST['from_date']!="" && $_POST['to_date']!="") { $additive = "&from_time=" . $_POST['from_date'] . " 00:00:00&to_time=" . $_POST['to_date'] . " 24:59:59"; } } elseif(in_array($category,$location_categories)) { $table = "location"; } elseif(in_array($category,$curator_categories)) { $table = "curator"; } $url = "search_results.php?table=$table&category=$category¶m=$param" . $additive; header("Location: $url"); } ?>