' . $word . ''; // create replacement $content = str_ireplace( $word, $replace, $content ); // replace content return $content; // return highlighted data } function highlight_words( $content, $words, $color ) { // loop through words foreach( $words as &$word ) { $content = highlight_word( $content, $word, $color ); // highlight word } return $content; // return highlighted data } if (empty($_REQUEST["ltbSearch"])) { echo '
'; include_once("includes/baggsconfig.php"); if (mysqli_connect_errno()) { printf("Unable to connect. Connection failed: %s\n", mysqli_connect_error()); exit(); } $stmt = $mysqli->prepare("SELECT ID, LTBArchive, LTBArchiveItem, Material, DatePlace, Notes1, Notes2 FROM BAGGSArchive ORDER BY LTBArchive, LTBArchiveItem ASC"); $stmt->bind_result($ID, $ltb, $item, $material, $dateplace, $notes1, $notes2); $stmt->execute(); $stmt->store_result(); echo '

The A.E. Baggs LTB Inventory

'; echo ''; echo ''; while($stmt->fetch()) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
LTB #      ItemMaterialDate / PlaceNotes 1Notes 2
' . $ltb . '' . $item . '' . $material . '' . $dateplace . '' . $notes1 . '' . $notes2 . '
'; } if (!empty($_REQUEST["ltbSearch"])) { echo '
'; include_once("includes/baggsconfig.php"); if (mysqli_connect_errno()) { printf("Unable to connect. Connection failed: %s\n", mysqli_connect_error()); exit(); } if(preg_match("/[a-zA-Z0-9_-]/", $_REQUEST["ltbSearch"])){ $ltbSearch=$_REQUEST["ltbSearch"]; $ltbSearch=$mysqli->real_escape_string($ltbSearch); $where = " (Material LIKE '%" . $ltbSearch . "%') OR (DatePlace LIKE '%" . $ltbSearch . "%') OR (Notes1 LIKE '%" . $ltbSearch . "%') OR (Notes2 LIKE '%" . $ltbSearch . "%')"; if (empty($where)) { header("Location: https://www.tworedroses.com/ltbarchives.php"); } else{ $stmt = $mysqli->prepare("SELECT * FROM BAGGSArchive WHERE" . $where . "ORDER BY LTBArchive, LTBArchiveItem ASC"); } $stmt->bind_result($ID, $ltb, $item, $material, $dateplace, $notes1, $notes2); $stmt->execute(); $stmt->store_result(); $words = explode(' ', $ltbSearch); if($stmt->num_rows > 0) { echo $stmt->num_rows . ' results for “' . $ltbSearch . '” found:'; echo '

The A.E. Baggs LTB Inventory

'; echo ''; echo ''; while($stmt->fetch()) { echo ''; $ltb = highlight_words($ltb, $words, $color); echo ''; $item = highlight_words($item, $words, $color); echo ''; $material = highlight_words($material, $words, $color); echo ''; $dateplace = highlight_words($dateplace, $words, $color); echo ''; $notes1 = highlight_words($notes1, $words, $color); echo ''; $notes2 = highlight_words($notes2, $words, $color); echo ''; echo ''; } echo '
LTB #      ItemMaterialDate / PlaceNotes 1Notes 2
' . $ltb . '' . $item . '' . $material . '' . $dateplace . '' . $notes1 . '' . $notes2 . '
'; } else { echo '

No Results Found

'; echo "

Sorry, we could not find a match for your search: “" . $ltbSearch . "”.

"; echo "

Please check your entry for accuracy and try again or click here to go back to the complete LTB Archives listing.

"; echo '

The A.E. Baggs LTB Inventory

'; echo ''; echo ''; echo '
LTB #      ItemMaterialDate / PlaceNotes 1Notes 2
'; } mysqli_close($mysqli); } } ?>