Ho creato questo modulo per effettuare le ricerche nel mio sito, e funziona fortunatamente
Vorrei inserire però anche il link della pagina che è stata trovata, e non solo il titolo e l'autore. Per visualizzare il funzionamento basta andare su http://wikiforix.lwsserver.com/yugioh/pagine/cerca.php (non è spam)
Ovviamente i dati dell'host, user etc nel file originale li ho scritti, ma qui no per ovvie ragioni
vi rigranzio per la risposta


codice:
<? 
$host=""; 
$user=""; 
$password=""; 
$database=""; 
?>
<html> 
<body>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> 
Stringa di ricerca: 
<input type="text" size="15" name="keywords"> 
<input type="submit" name="search" value="cerca"> 
</form> 
<hr>
<?php 
if ($_POST['search']){ 
if (!empty($_POST['keywords'])) { 
$searchStr = $_POST['keywords']; 
if (ereg("^[a-zA-Z ]+$", $searchStr)) {
mysql_connect($host,$user,$password)or die("connessione non riusciuta"); 
mysql_select_db($database)or die("Database non trovato");
print "Risultati per \"$searchStr\"
"; 
$keys = explode(" ", $searchStr);
for ($x = 0; $x < count($keys); $x++) { 
$querystr = "SELECT * FROM pagine WHERE titolo = \"$keys[$x]\" OR contenuto LIKE \"%$keys[$x]%\""; 
$result = mysql_query($querystr);
if ($frow = mysql_fetch_array($result)) { 
$found = true; 
do { 
echo "". $frow["titolo"] . " di ".$frow["autore"]."
";
} while ($frow = mysql_fetch_array($result)); 
}
} 
if (!$found) { 
print("Nessun risultato
"); 
}
} 
else { 
print("La parola chiave cercata presenta caratteri speciali non consentiti
"); 
} 
} 
else { 
print("Devi inserire una parola chiave
"); 
} 
} 
?>
</body>
</html>