Mega Code Archive
Categories
/
Php
/
Date Time
List people whose birthdays fall on the current Day and Month
// I wanted a simple way to find customers that had birthdays each day // of the week so I could send them a card. Here it is, Hope it helps. ?>
$db = mysql_connect("localhost", "root"); $Date = date("m/d"); mysql_select_db("customers",$db); $result = mysql_query("SELECT * FROM Cinfo WHERE Bday = '$Date'"); echo "
\n"; echo "
First Name
Last Name
Birthday
Year
\n"; while ($myrow = mysql_fetch_row($result)) { printf("
%s
%s
%s
%s
\n", $myrow[1], $myrow[2], $myrow[3], $myrow[4]); } echo "
\n"; ?>
The date today is,
echo date("M. d, Y");?>