questo script dovrebbe mostrami in tabella i vari record contenuti nel campo titolo di un db, quando viene ricercata una parola (invio la stringa da una text box posta in un altra pagina)ma quando provo a fare una ricerca compare la tabella ma senza risultati...
Perchè?!?!? dove sbaglio?

<?php
include("connessione.php");
$select = 'SELECT DISTINCT id, titolo';
$from = ' FROM dati';
$where = ' WHERE 1=1';

$chiave = $_POST['chiave'];
if ($chiave != '') { // Some search text was specified
$where .= " AND titolo LIKE '%$chiave%'";
}
?>
<table width="558">
<tr><th width="550"><div align="center"><span class="Stile7">Titolo del libro</span></div></th>
</tr>

<?php
$libri = @mysql_query($select . $from . $where);
if (!$libri) {
echo '</table>';
exit('

Error retrieving jokes from database!
'.
'Error: ' . mysql_error() . '</p>');
}

while ($libri = mysql_fetch_array($libri)) {
echo "<tr valign='top'>\n";
$id = $libro['id'];
$titolo = htmlspecialchars($libro['titolo']);
echo "<td>$titolo</td>\n";

echo "</tr>\n";
}
?>
</table>

grazie ciao!