Is there a more efficient way to construct my database so I don't have to wright this code out for each month? My overall result wants to look something like what is at http://www.afinkemachine.com/calendar/
which I have there in plain html. This php below is really my first app that I've been consuming myself with and probably is not very simplistic, which is why I'm asking for any suggestions. I don't want to start the db off wrong so I'm not screwed in the long run. Thank you very much for any ideas in advance.
$stmt = "SELECT venue.name, venue.street, venue.City, venue.phone, venue.directions, event.date, event.start, event.sm, event.end, event.em, DATE_FORMAT(event.date,'%a. %m/%d/%y') AS fmt_date
FROM venue,event
WHERE event.venueid = venue.venueid
AND '2002-02-28' < event.date
AND event.date < '2002-04-01'
ORDER BY UNIX_TIMESTAMP(event.date)";
$stmt2 = "select month, year from yearandmonth where month = 'march' and year = 2002";
if (!stmt)
{
return;
}
else
$result2 = mysql_query($stmt2);
$num_results2 = mysql_num_rows($result2);
{
$row = mysql_fetch_object($result2);
echo "<td>";
echo stripslashes($row->month)."\t";
echo stripslashes($row->year)."\t";
echo "</td><br><br>";
}
$result = mysql_query($stmt);
$num_results = mysql_num_rows($result);
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_object($result);
echo "<td>";
echo stripslashes($row->fmt_date)."\t";
echo stripslashes($row->start);
echo stripslashes($row->sm)."-";
echo stripslashes($row->end);
echo stripslashes($row->em)."\t";
echo stripslashes($row->name)." - ";
echo stripslashes($row->street)." ";
echo stripslashes($row->City)."-";
echo stripslashes($row->phone)."\t";
echo stripslashes($row->directions);
echo "</td><br><br>";
}