Here is the query so you can see more of what is going on. It is not the full function, but please dont bother with that as the rest is not needed for this issue.
function query_events ( $user, $want_repeated, $date_filter, $cat_id = '' ) {
global $login;
global $layers;
$result = array ();
$layers_byuser = array ();
$sql = "SELECT webcal_entry.cal_name, webcal_entry.cal_description, "
. "webcal_entry.cal_date, webcal_entry.cal_time, "
. "webcal_entry.cal_id, webcal_entry.cal_ext_for_id, "
. "webcal_entry.cal_priority, "
. "webcal_site_extras.cal_data, "
. "webcal_entry.cal_access, webcal_entry.cal_duration, "
. "webcal_entry_user.cal_status, "
. "webcal_entry_user.cal_login ";
if ( $want_repeated ) {
$sql .= ", "
. "webcal_entry_repeats.cal_type, webcal_entry_repeats.cal_end, "
. "webcal_entry_repeats.cal_frequency, webcal_entry_repeats.cal_days "
. "FROM webcal_entry, webcal_site_extras, webcal_entry_repeats, webcal_entry_user "
. "WHERE webcal_entry.cal_id = webcal_entry_repeats.cal_id AND "
. "webcal_entry.cal_id = webcal_site_extras.cal_id AND ";
} else {
$sql .= "FROM webcal_entry, webcal_site_extras, webcal_entry_user WHERE ";
}
$sql .= "webcal_entry.cal_id = webcal_entry_user.cal_id " .
"AND webcal_entry.cal_id = webcal_site_extras.cal_id " .
"AND webcal_entry_user.cal_status IN ('A','W') ";
What is of concern is the webcal_site_extras.cal_id and the webcal_entry.cal_id fields need to relate. webcal_entry has one single event with an id of 1. webcal_site_extras has many room reservations related to that event. Their id's match up with the id in webcal_entry...namely 1. When information about event 1 is displayed, it needs to show all of the related room reservations. So, you have a 1 (the event) to many (the rooms) relationship. Any ideas?