<?php include('config.php'); $time = strtotime("-14 days"); $nedeli = date("d.m.Y",$time); $q="SELECT * FROM `table` ORDER BY `birthday`"; $res=mysql_query($q); while($row=mysql_fetch_array($res)) { if(date($nedeli) <= date($row['date'])) { mail(".$row[''email].", "the subject", "message", "From: webmaster@$SERVER_NAME\r\n" ."Reply-To: webmaster@$SERVER_NAME\r\n" ."X-Mailer: PHP/" . phpversion()); } }} ?>