trucchi.php
codice:
<?php
// QUI CI METTI LA CONNESSIONE AL DATABASE
// QUI INSERISCI IL NOME DELLA TABELLA
$tabella = "trucchi";
// QUI PRENDE LA LETTERA DALL'INDIRIZZO
$lettera = $_GET['lettera'];
?>
<html>
<head>
<title>Trucchi: lettera <?php echo $lettera; ?></title>
</head>
<body>
Trucchi</p>
Lettera: <?php echo strtoupper($lettera); ?></p>
<table border="1" width="100%" id="table1">
<tr>
<td width="30%">Titolo</td>
<td width="70%">Trucchi</td>
</tr>
<?php
$query = "SELECT * FROM $tabella WHERE 'titolo' LIKE '$lettera%'";
$res = mysql_query($query) or die (mysql_error());
$tot = mysql_num_rows($res);
if ($tot == 0)
{
echo "<tr><td width=\"100%\" colspan=\"2\">Non ci sono giochi con questa lettera</td></tr>\n";
}
else
{
for ($x = 0; $x < $tot; $x++)
{
echo "<tr>\n";
echo "<td width=\"30%\">". mysql_result($res, $x, 'titolo') . "</td>\n";
echo "<td width=\"70%\">". mysql_result($res, $x, 'trucco') . "</td>\n";
echo "</tr>\n";
}
}
?>
</table>
</body>
</html>
e richiami la pagina con trucchi.php?lettera=a
ti crea una tabella un po' brutta, ma basta modificare il codice html, se non ci sono trucchi con quella lettera te lo scrive