<?php
// mysql configuration
$mysql_host = 'localhost';
$mysql_user = 'eichelnase';
$mysql_pass = 'abrissbirne';
$mysql_db = 'pimp';
// mysql connection
$mysql_id = @mysql_connect($mysql_host,$mysql_user,$mysql_pass) OR die(mysql_error());
@mysql_select_db($mysql_db,$mysql_id) OR die(mysql_error());
// get results from the mysql db
$result = @mysql_query("SELECT searchname,link FROM search WHERE searchname LIKE '%".addslashes($_POST['name_des_feldes_im_formular'])."%' ORDER BY link ASC",$mysql_id) OR die(mysql_error());
/* Du hast jetzt nur Datensätze im Result, die den
* Suchstring enthalten. Geordnet sind sie absteigend
* nach dem Link. Ob das sinnvoll ist, ist 'ne ganz an-
* dere Sache, aber in dem Beispiel hier isses halt so :-)
*/
// how much lines do we have
$count = @mysql_num_rows($result);
echo('Es wurden '.$count.' Datensätze gefunden !<br /><br />'."\n");
// clear the page variable
unset($page);
// for each line do
while ($row = @mysql_fetch_array($result)) {
// extending $page with the line
$page .= $row['id'].': <a href="'.htmlspecialchars($row['url']).'">'.htmlspecialchars($row['title']).'</a><br />'."\n";
}
// echo all output to the browser
echo($page);
?>