I have almost put together a calendar for displaying the different seasons that a hotel uses on different dates (ie high season, low season, etc.) The calendar runs a query for each day, so a six month calendar has 180 queries in it. That seems pretty hair-raising but it doesn't seem to have created a practical problem yet. However I'm now trying to get in the final refinement without doubling that to 360 queries.

My objective is to have a tooltip show the "season" when the cursor is hovered over a date. However the database table that is the subject of the 180 queries relates date to season_id. There is a separate table that relates season name to season_id.

This is the section of code that I currently have:
Code:
$datenow=$year."-".$month."-".$day_num;
mysql_select_db($database_MySQL_extranet, $MySQL_extranet);
$query_calendar = "SELECT season_id, offer_id FROM ex_dates WHERE hid='$hid' AND dt='$datenow'";
$calendar = mysql_query($query_calendar, $MySQL_extranet) or die(mysql_error());
$row_calendar = mysql_fetch_assoc($calendar);
if (($row_calendar['season_id'] != NULL)||($row_calendar['offer_id'] != NULL)) {
//if there is an offer
if ($row_calendar['offer_id'] != NULL) {
$datestyle='offer';
$datecell="<td class=\"cal_dates cal_".$datestyle."\"><a class=\"cal_tooltip\" href=\"#\">".$day_num."<span>".$row_calendar['offer_id']." Offer</span></a></td>";
//if there is no offer
}else {
$datestyle='season';
$datecell="<td class=\"cal_dates cal_".$datestyle."\"><a class=\"cal_tooltip\" href=\"#\">".$day_num."<span>".$row_calendar['season_id']." Season</span></a></td>";
}
}else {
$datestyle='noseason';
$datecell="<td class=\"cal_dates cal_".$datestyle."\">".$day_num."</td>";
}
}
echo $datecell;
$day_num++;
$day_count++;
The only way I can see at the moment to display the information I want is to put in a second query under the first, to get the season name that corresponds to to the season_id. However that would be inside the loop that repeats 180 times. Is there any way of putting a single query outside of the loop which would translate $row_calendar['season_id'] into the actual name of the season?

Thanks in anticipation. My apologies if this topic has been answered before, but I can't think of any succint search terms to describe my question.