0
I need to take only the "day" of the person’s birthday in SQL.
include("conexao.php"); $mes = date("m"); $consulta = $conn->query("SELECT * FROM niver WHERE niver LIKE '%".$mes."%'"); while($linha = $consulta ->fetch(PDO::FETCH_ASSOC)) { echo "
"; echo "Nome do Aniversariante: {$linha['nome']}
"; echo "{$linha['niver']}"; }
With this code I can catch the birthday kids of the current month. But now I want to show only his birthday.
WHERE MONTH( niver ) = mes
– Bacco
If you want to take the day, literally, use it
SELECT DAY(niver) FROM ...
, provided it is in DATETIME or DATE format....– Inkeliz
SELECT DAY( field ) shows the day, WHERE MONTH( field ) = selects the month, and if you need year, you have the YEAR( field )
– Bacco