"; // Work out which day we want to look at $date = date(r); $year = date(Y); $weekcount = date(W); $day = ""; $month = ""; $dayofweek = ""; if ($Awhichday == 0 ) { $day = date(d); $month = date(m); $dayofweek = date(N); } else if ($Awhichday == -1 ) { $yesterDay = time() - (24 * 60 * 60); $day = date(d, $yesterDay); $month = date(m, $yesterDay); $dayofweek = date(N, $yesterDay); } else if ($Awhichday == 1 ) { $nextDay = time() + (24 * 60 * 60); $day = date(d, $nextDay); $month = date(m, $nextDay); $dayofweek = date(N, $nextDay); } $daycount = date(z) + 1; $daysleft = 365 - $daycount; // Give some basic date information echo "

Today is " . $date . "
"; echo "It is day $daycount and week $weekcount of $year. There are $daysleft days left in the year


"; // Retrieve the data once from the database $conn = @mysql_pconnect($server,$user,$pass) or die ("unable to connect"); $select = mysql_select_db($database,$conn) or die ("unable to select db"); $result=mysql_db_query($database, "SELECT eventtype,eventyear,weekday,article FROM $table WHERE eventday = \"$day\" AND eventmonth = \"$month\" ORDER BY eventyear ASC"); $birthlist = ""; $eventlist = ""; $reminderlist = ""; // Loop through the results and work out what is which while ($data=mysql_fetch_array($result)) { if ($data[0] == "B") { $birthlist .= "
  • $data[1] - $data[3]
    "; } else if ($data[0] == "S") { $eventlist .= "
  • $data[1] - $data[3]
    "; } else if ($data[0] == "R" && $data[2] == $dayofweek) { $reminderlist .= "
  • $data[1] - $data[3]
    "; } } if (strlen($birthlist) > 1) { // Output birth information if anything exists echo "

    \n

    Born $F_whichday

    "; echo "
      "; echo $birthlist; echo "

    \n"; } if (strlen($eventlist) > 1) { // Output event information if anything exists echo "

    \n

    Events $F_whichday

    \n"; echo "
      "; echo $eventlist; echo "

    "; } if (strlen($reminderlist) > 1) { // output reminder information if any exist for this date echo "

    \n

    Don't forget

    "; echo "
      "; echo $reminderlist; echo "

    "; } // END OF THE TODAY IN HISTORY IMPLEMENTATION EVERYTHING ELSE IS WINDOW DRESSING ?>

    This is a PHP implementation of Puppet Master's original perl script (however I cannot locate his/her site despite the popularity of the script). There are some advantages in that and probably some disadvantages. The code is available to tinker with, so is the data file. If you do make improvements please contact me (I'll even set up decent versioning etc), I am particularly keen to add dates that are less eurocentric.