1) { $colid = $_SESSION['colid']; $col = " AND collectionID:($colid)"; $url .= urlencode($col); } $url .= "&start=0&rows=5000&fl=objID"; $yoursearch .= ")"; $file = file_get_contents($url); $xml = simplexml_load_string($file) or die ("Unable to load XML file!"); $query = "select * from newobjects where metsid in (\"\""; foreach ($xml->result->doc as $doc) { $query .= ", \"$doc->str\""; } $query .= ") order by label"; $hitlist = mysql_query($query); $count = mysql_num_rows($hitlist); if ($count >0) { while($hitlistArray[] = mysql_fetch_assoc($hitlist)); array_pop($hitlistArray); $_SESSION['hitlistArray'] = $hitlistArray; $_SESSION['count'] = $count; $_SESSION['yoursearch'] = $yoursearch; $_SESSION['sender'] = "search"; require("display.php"); } else { echo "$yoursearch
"; echo "Sorry, no matching records found..."; } } else { echo "Sorry, you need to use at least one search term."; } function createQuery($data, $operand, $field) { $keywords = preg_replace('@[\s]+@',' ', trim($data)); $terms = split(" +", $keywords); $string = "$field:("; $termcount = 1; if ($operand == "PHRASE") { $string .= "\""; } foreach ($terms as $term) { if ($termcount >1) { $stub .= " "; } if ($operand == "AND") { $stub .= "+"; } $stub .= "$term"; $termcount++; } $string .= urlencode($stub); if ($operand == "PHRASE") { $string .= "\""; } $string .= ")"; return $string; } ?>