I think mine is a fairly simple question. In fact, I
think my script may just need a simple tweak. It's
also possible that my problem relates to displaying
the data with PHP, but I want to make sure I've got my
MySQL table set up correctly.

Anyway, I've collected historic events for every day
of the year - including multiple events for some days.
Now I want to create a web page that will display
events that occurred on January 1 (various years) when
it's January 1. When the clock hits midnight, it will
display events that occurred on January 2.

So I created a database table named "gzcalendar" with
three fields. The first field will simply be numbered
1-366, for every day of the year (including leap
years). As you can see, Cal_Date lists dates, while
events are listed under Cal_Event.

Cal_ID | Cal_Date | Cal_Event
1 | 1972-01-01 | A new species of whale was
discovered.
7 | 1898-01-07 | The dodo was declared extinct.
8 | 1972-01-08 | The first Earth Day was observed.

Then I used this script to try to display a sample:

<?php
$date = date("Y-m-d");
$sql = "SELECT Cal_Event FROM gzcalendar WHERE
Cal_Date = '$date'";
$res = mysql_query($sql);
while($row = mysql_fetch_assoc($res))
{
    print($row['Cal_Event'] . "<br />");
}
?>

It doesn't work, and I'm guessing it's because of the
first line - $date = date("Y-m-d");

If someone visits my website on January 7, 2005
(2005-01-07), then they're not going to connect with
an event that occurred on January 7, 1888, right?

It seems to me I want something like this:

$date = date("m-d");

So if someone visits my website on January 7, they'll
see an event that occurred on January 7, regardless of
the year.

But I haven't yet figured out exactly how to do that?
If I can at least get my table set up correctly, then
I can get some advice for displaying it from a PHP
forum. I also want to learn how to display data for
each day of the week - Sunday, Monday, etc.

Thanks!

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to