$discovery->referrals = $_POST['e_referrals'];
        $discovery->others = $_POST['e_others'];
        $discovery->update();
        //----------------------------------------------------------------------------------------------------------------------------------//
        $enrollmentDetail = EnrollmentDetail::get_by_id($student->enrollment_detail_id);
        $enrollmentDetail->status = $_POST['f_status'];
        $enrollmentDetail->program = $_POST['f_program'];
        $enrollmentDetail->schedule = $_POST['f_schedule'];
        $enrollmentDetail->payment = $_POST['f_payment'];
        $enrollmentDetail->studentcontactnumber = $_POST['f_studentcontactnumber'];
        $enrollmentDetail->update();
        //----------------------------------------------------------------------------------------------------------------------------------//
        $appointmentDetail = AppointmentDetail::get_by_id($student->appointment_detail_id);
        $appointmentDetail->visitschedule = strtotime($_POST['g_visitschedule']);
        $appointmentDetail->visitpurpose = $_POST['g_visitpurpose'];
        $appointmentDetail->officer = $_POST['g_officer'];
        $appointmentDetail->update();
        //----------------------------------------------------------------------------------------------------------------------------------//
    } else {
        if ($_POST['oper'] == 'del') {
            $student = Student::get_by_id($_POST['id']);
            $student->delete();
            AppointmentDetail::get_by_id($student->appointment_detail_id)->delete();
            EnrollmentDetail::get_by_id($student->enrollment_detail_id)->delete();
            StiDiscovery::get_by_id($student->sti_discovery_id)->delete();
            SchoolConsidered::get_by_id($student->school_considered_id)->delete();
            SchoolLastAttended::get_by_id($student->school_last_attended_id)->delete();
            PersonalInformation::get_by_id($student->personal_information_id)->delete();
        }
    }
}
    //$students = Student::get_by_sql("SELECT * FROM ".T_STUDENTS." INNER JOIN ".T_PERSONAL_INFORMATIONS." ON ".T_PERSONAL_INFORMATIONS.".student_id=".T_STUDENTS.".id ORDER BY ".T_STUDENTS.".id $sord LIMIT $start , $limit");
    $students = Student::get_by_sql("SELECT * FROM " . T_STUDENTS . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
}
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($students as $student) {
    $s .= "<row id='" . $student->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $student->id . "</cell>";
    $s .= "<cell>" . $student->studentid . "</cell>";
    //----------------------------------------------------------------------------------------------------------------------------------//
    $personInfo = PersonalInformation::get_by_id($student->personal_information_id);
    if (!$personInfo) {
        $personInfo = new PersonalInformation();
    }
    $s .= "<cell>" . $personInfo->firstname . "</cell>";
    $s .= "<cell>" . $personInfo->lastname . "</cell>";
    $s .= "<cell>" . $personInfo->middlename . "</cell>";
    $s .= "<cell>" . $personInfo->address . "</cell>";
    $s .= "<cell>" . $personInfo->father . "</cell>";
    $s .= "<cell>" . $personInfo->mother . "</cell>";
    $s .= "<cell>" . $personInfo->guardian . "</cell>";
    $s .= "<cell>" . $personInfo->gender . "</cell>";
    $s .= "<cell>" . $personInfo->civilstatus . "</cell>";
    $s .= "<cell>" . $personInfo->citizenship . "</cell>";
    $s .= "<cell>" . $personInfo->birthday . "</cell>";
    $s .= "<cell>" . $personInfo->email . "</cell>";