Hi,
I'm trying to do a list of news, but i only want today's news and news from the past what i don't want is future news(tomorrow,...).
So i'm doing if the date <=$curdate, but future news appear anyway, can you help me, plz?
<?php
$curdate = date("d/m/Y");
$row_noticias = getRows("SELECT n.id, str_to_date(n.data, '%d/%m/%Y') AS date, nl.id_noticia, nl.titulo, nl.descricao, nl.resumo
FROM `noticias` as n, `noticias_lang` as nl
WHERE n.id = nl.id_noticia AND
nl.lang='$current_lang' AND n.visivel=1 AND nl.visivel=1
ORDER BY date DESC LIMIT 1");
foreach($row_noticias as $key => $noticia)
{
echo $noticia['date'] < $curdate;
die;
$query_data=mysql_query("SELECT * FROM noticias WHERE data='".$curdate."'") or die(mysql_error());
$data=mysql_fetch_assoc($query_data);
if ($data['data'] < $curdate )
{
echo "<label>".formatdate($data['data'])."</label>";
echo "<a href='".$current_lang."/noticia/".$noticia['id_noticia']."'>".get_substr($noticia['resumo'], 140)."</a>";
}
}
?>