danke aber trotzdem dafür!|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 |
<ul class='LSRes'> <? $res = mysql_query("SELECT * FROM TABELLE WHERE Spalte LIKE '%". $_GET['q'] ."%'; "); while($row = mysql_fetch_object($res)) { echo '<li class="LSRow"> » <a href="'.$row->link.'">'.$row->title.'</a></li>'; } ?> </ul> |
|
|
HTML Code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<html> <head> <title>Searchtest/title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript" src="livesearch.js"></script> </head> <body onload="liveSearchInit()"> <form onsubmit="return liveSearchSubmit()" id="FormName" action="http://blog.liip.ch//" method="get" name="searchform"> <input onkeypress="liveSearchStart()" id="livesearch" type="text" name="q" /> <div id="LSResult" style="display: none;"> <ul id="LSShadow"> <li> </li> </ul> </div> </form> </body> </html> |
aber danke für deine Mühen
Ich habe einfach mal die
nun gehts super !!!!
alles so gemacht wie du es gesagt hattest! den head hatte ich dann auch selber schon gefunden! Aber daran lag es auch nicht das es nicht geht!|
|
JavaScript Code |
1 2 3 4 5 6 7 8 9 10 11 |
<ul class='LSRes'> <? include ('dbconf.inc.php'); $res = mysql_query("SELECT * FROM e_benutzer WHERE B_Username LIKE '%". $_GET['q'] ."%'; "); while($row=mysql_fetch_array($res)) { echo '<li class="LSRow"> » <a href="'.$row['B_Username'].'">'.$row['B_Username'].'</a></li>'; } ?> </ul> |
Quoted from ""Afri""
Also es ist ein wenig komisch! Gebe ich was ein in dem Input dann kommt Objekt nicht gefunden! Drücke ich aber nach der Eingabe die Entertaste so erscheinen die Richtigen Ergebnisse allerdings dann auf einer neuen seite!
Was muss ich ändern damit es auf der gleichen Seite steht?
)|
|
PHP Quellcode |
1 2 3 |
function highlight_searchResult($text, $needle) { return preg_replace( "/(^|\s|,!|;|\>)(".preg_quote($needle, "/").")(\s|,|!|&|$|\<)/i", "\\1<span class='search_highlight'>\\2</span>\\3", $text); } |
Quoted from ""Nico""
Dito, habe leider das gleiche Problem.
|
|
JavaScript Code |
1 |
<script type="text/javascript">var liveSearchRoot="/Ajax/Search/"</script> |
|
|
PHP Quellcode |
1 2 3 |
<?php header("Content-type: text/xml;charset=ISO8859-1"); ?> |
|
|
HTML Code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<? require ("./global.php"); header("Content-type: text/html;charset=ISO8859-1"); ?> <html> <head> <title>Searchtest/title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript" src="./js/livesearch.js"></script> </head> <body onload="liveSearchInit()"> <form id="searchform" action="./include/livesearch.php" method="get" onsubmit="return liveSearchSubmit()"> <b>Part Number or Type:</b> <input id="livesearch" name="q" type="text" size="30" onkeypress="liveSearchStart()"><div id="LSResult" style="display: none;"><div id="LSShadow"></div></div> </form> </body> </html> |
|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<? header("Content-type: text/xml;charset=ISO8859-1"); include("./config.inc"); require("./class_db.php"); echo "<?xml version='1.0' encoding='utf-8' ?>"; $db = new db($db_server,$db_user,$db_passwort,$db_name,$phpversion); ?> <ul class='LSRes'> <? $ergebnis = mysql_query ("SELECT * FROM user WHERE nachname LIKE '$q%' OR vorname LIKE '$q%' ORDER BY nachname LIMIT 15") or die ("SQL-Fehler"); //$ergebnis = mysql_query ("SELECT * FROM user WHERE MATCH (nachname,vorname) AGAINST ('$q')"); while ($datensatz = mysql_fetch_array($ergebnis)) { echo "<li class='LSRow'>$datensatz[nachname] $datensatz[vorname]</li>"; } ?> |
|
|
PHP Quellcode |
1 |
echo "<?xml version='1.0' encoding='utf-8' ?>"; |
|
|
JavaScript Code |
1 2 3 4 5 6 7 |
function liveSearchHide() { document.getElementById("LSResult").style.display = "none"; var highlight = document.getElementById("LSHighlight"); if (highlight) { highlight.removeAttribute("id"); } } |
|
|
JavaScript Code |
1 2 3 |
function liveSearchHide() { return false; } |