How not to display past date records

5

I made a schedule and I need events that have already passed do not appear any more, the dates are with 3 DAY / MONTH / YEAR fields, I am using concat and date to join and format the dates, so the current query is as follows:

$query = mysql_query("SELECT * FROM 'tabela1' WHERE 'evento' LIKE '%$busca%' ORDER BY date(concat(ano,'-', mes,'-',dia)) ASC") or die(mysql_error());
    
asked by anonymous 13.04.2014 / 07:38

1 answer

3
SELECT *
FROM 'tabela1'
WHERE 'evento' LIKE '%$busca%'
AND 'nomeDoCampoData' > '2014-04-10'
ORDER BY date(concat(ano,'-', mes,'-',dia)) ASC

If you want to pick between a period use between

SELECT *
FROM 'tabela1' 
WHERE 'evento' LIKE '%$busca%'
AND 'nomeDoCampoData' BETWEEN '2014-04-10' AND '2014-04-13'
ORDER BY 'nomeDoCampoData'

Tip do not use a field for each: date, month, year ... Use only one field of type DATE

    
13.04.2014 / 07:56