Salve :ciaociao:
ho un problema riguardo questo codice:
il problema è che avviando lo script non riesco a visualizzare il contenuto del database sotto forma di una tabella. Qualcuno può aiutarmi?
Grazie.
ho un problema riguardo questo codice:
Codice:
<html><head><title>Elenco partite</title>
</head>
<body>
<?php
$hostname="...";
$username="...";
$password="...";
$conn=mysql_connect($hostname,$username,$password);
if(!conn){
echo("Errore durante la connessione al MySQL.");
exit();
}
$db1=mysql_select_db('avvenimenti',$conn);
?>
<!-- intestazione tabella -->
<table border = "1">
<tr><th>Palinsesto</th>
<th>Avvenimento</th>
<th>Partita</th>
<th>1</th>
<th>X</th>
<th>2</th>
</tr>
<?php
$query = mysql_query("SELECT * FROM avvenimenti");
($riga=mysql_fetch_array($query)){
echo"<tr>";
echo"<td>" . $riga["palinsesto"] . "</td>";
echo"<td>" . $riga["avvenimento"] . "</td>";
echo"<td>" . $riga["part"] . "</td>";
echo"<td>" . $riga["uno"] . "</td>";
echo"<td>" . $riga["x"] . "</td>";
echo"<td>" . $riga["due"] . "</td>";
echo"</tr>";
}
// Chiudo db.
mysql_close($conn);
?>
</table>
</body>
</html>
Grazie.