$sql = "SELECT birthday_name,birthday_surname,date_of_birth FROM tblbirthdays";
$result = pg_exec($dbconn,$sql);
$numr = pg_numrows($result);
$token = strtok(date('Y-m-d')," \-");
if ($token)
{
$day = $token;
}
if ($token)
{
$token = strtok(" \-");
$month = $token;
$token = strtok(" \-");
$year = $token;
}
$current_date = $month."-".$token;
//echo $current_date;
if($numr != 0)
{
echo "The Department wishes a happy birthday to....";
while($r = pg_fetch_array($result))
{
$token = strtok($r["date_of_birth"]," \-");
if ($token)
{
$day = $token;
}
if ($token)
{
$token = strtok(" \-");
$month = $token;
$token = strtok(" \-");
$year = $token;
}
$db_date = $month."-".$token;
//echo $month."-".$token." ";
if($current_date == $db_date)
{
echo "
".$r["birthday_name"]." ".$r["birthday_surname"]." ";
}
}
}else{
echo "There are no Birthdays today";
}
?>
|