CURDATE() is not working
Page 1 of 1
CURDATE() is not working
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 using CURDATE -> if date <= CURDATE the news appear, but future news appear anyway, can you help me, plz?
- Code: Select all
$curdate = date("d-m-Y");
$row_noticias = getRows("SELECT n.id, n.data, 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 n.data < $curdate
nl.lang='$current_lang' AND n.visivel=1 AND nl.visivel=1
ORDER BY date DESC LIMIT 1");
EDIT: i changed the code, and i did an echo of $curdate and it's alright, but when i have like this:
- Code: Select all
n.data < $curdate
it gives me error:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\www.af-reabilitacao.com\common.php on line 59
Thank you,
PF2G
Re: CURDATE() is not working
Hi,How the "n.data" field is saved in your table? What is the data type of this field? Can you give me a sample record stored in that field?
Re: CURDATE() is not working
Hi,Firstable thank you for the reply.
Burt i already solved the problem...
Thnak you,
PF2G
Page 1 of 1