Ancora una volta ecco un incasinamento di query:
codice:
<table width="100%" border="0" bgcolor="#F2F2F2">
<tr>
<td>
<?
if ($ID_areesx=="") {
$ID_areesx="2";
}
$query = "SELECT ID_areesx,Titolo_areesx FROM areesx WHERE ID_areesx = $ID_areesx";
$result = mysql_query($query, $db);
while ($rows = mysql_fetch_array($result)) {
echo "[img]images/indice3.gif[/img] ".$rows["Titolo_areesx"]."";
}
?>
</td>
</tr>
</table>
<?
$query = "SELECT ID,Titolo,Descrizione,Testo,Data,Ora,Scadenza,Area,Link,Sottoarea,Sottoarea2 FROM notizie WHERE Area = $ID_areesx";
$result = mysql_query($query, $db);
while ($rows = mysql_fetch_array($result)) {
$link = $rows["Link"];
$area = $rows["Area"];
$sottoarea = $rows["Sottoarea"];
$sottoarea2 = $rows["Sottoarea2"];
if ($link=="" AND $sottoarea=="" AND $sottoarea2=="") {
echo "[img]images/indice2.gif[/img] <font size=2><a href=articolo.php?ID=".$rows["ID"].">".$rows["Titolo"]."</a></font>
";
}
if ($link!="" AND $sottoarea=="" AND $sottoarea2=="") {
echo "[img]images/indice2.gif[/img] <font size=2>".$rows["Titolo"]."</font>
";
}
if ($sottoarea!="" AND $link=="" AND $sottoarea2=="") {
$query2 = "SELECT ID,Titolo,Area,Link FROM sottoaree WHERE Area = $ID_areesx AND ID = $sottoarea";
$result2 = mysql_query($query2, $db);
while ($rows2 = mysql_fetch_array($result2)) {
if ($rows2["Link"]=="") {
echo "[img]images/indice2.gif[/img] <font size=2><a href=sottoarea.php?ID=".$rows2["ID"]."&ID1=".$ID_areesx.">".$rows2["Titolo"]."</a></font>
";
} else {
echo "[img]images/indice2.gif[/img] <font size=2>".$rows2["Titolo"]."</font>
";
}
}
}
}
?>
L'ultima però mi ripete 2 volte i record, perché?