Riporto tutto il codice, così è più facile.
Codice PHP:
$query = "SELECT * FROM Correlate WHERE News1 = '$News' OR News2 = '$News'";
$result = mysql_query($query, $db);
$correlate = mysql_num_rows($result);
if ($correlate==0) {
echo "<center>[b]Non ci sono news simili[/b]</center>";
} else {
$i = 0;
while ($row = mysql_fetch_array($result)) {
$i++;
$id1 = $row["ID"];
$idx[$i] = $id1;
$n1 = $row["News1"];
$na[] = $n1;
$n2 = $row["News2"];
$nb[] = $n2;
}
$nanb = array_merge($na, $nb);
$strnanb = implode(",", $nanb);
$query2 = "SELECT * FROM News WHERE ID IN($strnanb) AND ID != $News $posticipata ORDER BY Data DESC";
$result2 = mysql_query($query2, $db);
while($row2 = mysql_fetch_array($result2)) {
$id2 = $row2["ID"];
$tit = $row2["Titolo"];
echo "<a href=\"pag.php?Pag=news&News=$id2\" title=\"$tit\">$tit</a>";
if ($Modalita=="1" OR $Modalita=="2") {
echo "
<a href=\"pag.php?Pag=elimina_correlata&News=$idx[$i]\" style=\"color: red;\">Elimina</a>";
}
echo "
";
}
}