function edit_spider_event($calendar_id, $id)
{
    global $wpdb;
    $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'spidercalendar_event WHERE id=%d', $id));
    $calendar = $row->calendar;
    $query = $wpdb->prepare('SELECT title FROM ' . $wpdb->prefix . 'spidercalendar_calendar WHERE id=%d', $calendar);
    $calendar_name = $wpdb->get_var($query);
    $cal_name = $wpdb->get_var($wpdb->prepare('SELECT title' . ' FROM ' . $wpdb->prefix . 'spidercalendar_calendar WHERE `id`="%d"', $calendar_id));
    html_edit_spider_event($row, $calendar_id, $id, $cal_name);
}
function edit_spider_event($calendar_id, $id)
{
    global $wpdb;
    $row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'spidercalendar_event WHERE id=\'' . $id . '\'');
    $calendar = $row->calendar;
    $query = 'SELECT title' . ' FROM ' . $wpdb->prefix . 'spidercalendar_calendar WHERE id=' . $calendar;
    $calendar_name = $wpdb->get_var($query);
    $cal_name = $wpdb->get_var('SELECT title' . ' FROM ' . $wpdb->prefix . 'spidercalendar_calendar WHERE id=' . $calendar_id);
    html_edit_spider_event($row, $calendar_id, $id, $cal_name);
}