i have this php code which sends email to those celebrating their bday on a daily basis. it works pretty well.
but now i want something more. i have on my database a field called language. now i want is the email message text changes according to the language, i.e. when they have english message is sent while if spanish or italian, another message is sent. how could i do that? here is my present code. thanks.
<?
//Connector
// connection here
//Send email to user
$time = date("l, F j");
$result_num_birthdays_today=mysql_query("select count(*) from users
WHERE DATE_FORMAT(bday, '%m-%d') = '" . date ('m-d') . "'")
or die ("Couldn't read the number of birthdays for this date.");
$num_birthdays_today = mysql_result($result_num_birthdays_today, 0, 0);
print("Today there are $num_birthdays_today birthdays today<br>");
$result = mysql_query ("SELECT name, surname, email, bday, year(bday) AS year from users
WHERE DATE_FORMAT(bday, '%m-%d') = '" . date ('m-d') . "'");
while ($row = mysql_fetch_assoc ($result))
{
extract ($row);
$how_old = date ('Y') - $year;
$to = "$name $surname <$email>";
$from = 'from: me <me@me.net>';
$subject = 'Happy Birthday!';
$message = "$time
Dear $name $surname, you are $how_old today. HAPPY BIRTHDAY!
sirTemplar";
$mail = @mail($to, $subject, $message, $from);
if ($mail) {echo 'mail sent<br>';} else {echo 'mail FAIL<br>';}
}
?>