On Thu, August 10, 2006 12:14 pm, William Stokes wrote: > I have a calendar script that displays a simple mini calendar view one > month > at a time. User can click any date and the calendar opens another page > that > displays that date's events. I would like to highlight to the mini > calendar > view dates that have an event in database. So what would be a simple > way to > check for events while the selected months days are printed to screen? Depending on the number of records, the PHP<->MySQL connection speed, and the indexes or lack thereof on your date column... 1. You could do a query for each date like: select count(*) from events where whatdate = '$date' 2. You could pre-fill an array with dates that have an event: select whatdate from events where whatdate >= '$month/1/$year' and whatdate < '{$month+1}/1/$year' /*might need something better here*/ group by whatdate order by whatdate while (list($whatdate) = mysql_fetch_row($result)){ $event_date[$whatdate] = true; } Then, while filling out the calendar, just check: if (isset($event_date[$date])){ //color it as having events } -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php