Ciao a tutti,
ho un database con una tabella "eventi" i cui record sono : ID , data (YYYY-MM-DD) , evento , luogo.
visto che dovrò inserire degli eventi che vanno dal 2000 ad oggi, sarebbe più comodo visualizzarli secondo l'anno tramite un menu a tendina.
ecco il mio codice :
Mi aiutate?
Ringrazio in Anticipo
ho un database con una tabella "eventi" i cui record sono : ID , data (YYYY-MM-DD) , evento , luogo.
visto che dovrò inserire degli eventi che vanno dal 2000 ad oggi, sarebbe più comodo visualizzarli secondo l'anno tramite un menu a tendina.
ecco il mio codice :
PHP:
<?php
include ("config.php");
include ("connect.php");
// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM eventi ORDER BY CAST(data AS DATE)")
or die(mysql_error());
//echo "<tr> <th>Data</th> <th> Evento </th> <th>Luogo</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<table width='100%' border='1'>";
echo"<tr>";
echo "<th width='10%'>Data</th>";
echo"<td>";
echo $row['data'];
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"<th width='10%'>Luogo</th>";
echo"<td>";
echo $row['luogo'];
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"<th width='10%'>Evento</th>";
echo"<td>";
echo $row['evento'];
echo"</td>";
echo"</tr>";
echo"</table>";
echo"<br/><br/>";
}
?>
Mi aiutate?
Ringrazio in Anticipo