Intendi un ciclo foreach?
Sul foreach ho trovato un pò di codice.
Stampa tutto il contenuto del database, ma non so come associare il link ad ogni campo "titolo".
Codice PHP:
$query = "select id, data, titolo from `avvisi`";
$dbResult =mysql_query($query, $db);
$AffectedRows = mysql_affected_rows($db);
$table_name = mysql_table_name($AffectedRows);
print ("<h3>$db_host $table_name</h3>");
print ("<table border=\"1\">\n");
for ($index=0; $index<$AffectedRows ; $index++)
{
$row=mysql_fetch_row($dbResult);
if ($index==0)
{
print "<tr>\n";
foreach ($row as $k => $v)
{
$myfield =mysql_fetch_field($dbResult, $k);
print ("<td><b>" . $myfield->name . "</b></td>");
}
print "</tr>\n";
}
foreach ($row as $k => $v)
{
print ("<td>$v ");
print ("</td>");
}
print "</tr>\n";
}
print "</table>\n";
Grazie