echo "<B><BR>List of the
Day</B><BR>&nbsp;<A
HREF=\"$query[link]\">$query[listname]</A><BR>";

?>

Notice the line near the middle - $mod = $today % 89;

That line tells PHP to use modulo arithmetic to divide today's
date (converted to a number) by 89 and discard everything but the
remainder. This would give us 89 unique values - just what we need
with 89 entries in the Mac of the Day database.

The problem is, modulo arithmetic returns a remainder from 0
(zero) to one less than your maximum number, so our function was
using numbers from 0 to 88. And our database uses numbers from 1 to
89.

We use a similar function to handle the 38 email lists, and
that's where I noticed the problem this morning. Today the email
list script was returning zero, so no list was displayed.

All we have to do is add one to the number returned to have
values in the range we need. I've modified two lines, uploaded the
new script, and now everything works:

$mod = ($today % 89) + 1;
$lod = ($today % 38) + 1;

The Next Project

I'd planned on automating site links next, but have instead
decided that the next project will be automating the Deal of the
Day. This will involve real calendar dates, not raw numbers based
on seconds since 1970.01.01.