$res = mysql_query("SELECT *, YEAR(Data) AS Anno, MONTH(Data) AS Mese, DAY(Data) AS Giorno FROM ".TABLE."Annunci ORDER BY Data DESC, ID DESC");
if(mysql_num_rows($res) <= 0) {
?>
Non sono presenti annunci.
} else {
while($annunci = mysql_fetch_array($res))
{
$immagine = mysql_query("SELECT * FROM ".TABLE."GalleryAnnunci WHERE IDParent = ".$annunci['ID']." AND IsPrincipale = 1");
if(mysql_num_rows($immagine) == 0) {
$immagine = mysql_query("SELECT * FROM ".TABLE."GalleryAnnunci WHERE IDParent = ".$annunci['ID']." ORDER BY ID DESC");
}
?>
if($annunci['Prezzo'] != 0) { ?>
Prezzo: €
} ?>
echo($annunci['Giorno']."/".$annunci['Mese']."/".$annunci['Anno']); ?>
$descrizione = strip_tags($annunci['Descrizione']);
if(strlen($descrizione) > 200)
$descrizione = substr($descrizione, 0, 200) . '...';
echo("
".$descrizione."
");
?>
}
}
?>