Location: PHPKode > projects > iLP System > Release 2.2/upload/lib/lib.search.live.php
<?php
/**
 * iLP System AJAX Livesuche
 * 
 * Autor:		Florian "ApoY2k" Peschka
 * Projekt:		iLP System
 * Paket:		apoy2k.ilp.wrynn.lib
 * Lizenz:		CreativeCommons (by-nc-sa)
 * Kontakt:		hide@address.com
 * Version:		2.2
 */

// Konfiguration einbinden
require_once('lib.config.php');

// Suche starten, sobald ein Suchbegriff eingegeben wurde
if (isset($_GET['term']))
{
	
	// Nach dem Suchbegriff suchen
	$get_from_cache = $db->prepare("SELECT ilp_itemcache.item_id FROM ilp_itemcache WHERE ((ilp_itemcache.name_en LIKE :string_term OR
		ilp_itemcache.name_de LIKE :string_term OR
		ilp_itemcache.name_es LIKE :string_term OR
		ilp_itemcache.name_fr LIKE :string_term OR
		ilp_itemcache.name_ru LIKE :string_term) OR ilp_itemcache.item_id = :int_term)");
	
	// Umwandlung der eingegebenen Suche in einen Integer.
	$searchitem_id = intval($_GET['term']);
	
	// Suche starten
	$get_from_cache->execute(array(':string_term' => '%'.$_GET['term'].'%', ':int_term' => $_GET['term']));
	
	// Gefundene Gegenstände auflisten
	if (1 <= $get_from_cache->rowCount())
	{
		$items = $get_from_cache->fetchAll(PDO::FETCH_ASSOC);
		echo '<ul>';
		foreach ($items as $row)
		{
			if (isset($_GET['set_id']))
			{
				echo '<li>'.getWowHeadLink($row['item_id'], $lang['tooltip_locale'], array('set_id' => $_GET['set_id'])).'</li>';
			}
			else
			{
				echo '<li>'.getWowHeadLink($row['item_id'], $lang['tooltip_locale']).'</li>'; 
			}
		}
		echo '</ul>';
	}
}
?>
Return current item: iLP System