hi. this is my sql query to print people whose celebrating their birthday on current day:
$result = mysql_query ("SELECT NAME, SURNAME, EMAIL,
YEAR(NATDAT) AS NATYEAR FROM table
WHERE substring(NATDAT,6) = substring(curdate(),6)
ORDER BY SURNAME ASC, NOMRL
",$conn);
if ($row = mysql_fetch_array($result)) {
do {
echo "etc. etc.......................
it works fine. what i want to do now is to create a script that when i run it will automaticall send an email to people celebrating their bday on current day.
i tried adding this after the querry but it doesn't work:
<?
//Send email to user
$headers = "Content-Type: text/html";
$headers = "From: My Website <me@me.net>";
$email = $row ['EMAIL'];
mail ("$email", "Birthday: MY Site", "Happy Birtday
from ME!",$headers);
echo "<font face=Verdana size=4 color=#FF0000>Email sent";
?>
i also want to echo how many email were sent or if not sent.
thanks.