if (mysql_num_rows($result) !== 0) {
            $addnew = false;
        }
    }
}
//var_dumpclean_up($_POST);
$first_name = clean_up($_POST["first_name"]);
$last_name = clean_up($_POST["last_name"]);
$street_address = clean_up($_POST["street_address"]);
$city = clean_up($_POST["city"]);
$state = clean_up($_POST["state"]);
$zip_code = clean_up($_POST["zip_code"]);
$email = clean_up($_POST["email"]);
$banner_id = clean_up($_POST["banner_id"]);
$home_phone = store_phone(clean_up($_POST["home_phone"]));
$mobile_phone = store_phone(clean_up($_POST["mobile_phone"]));
$alternate_email = clean_up($_POST["alternate_email"]);
$faculty_status = clean_up($_POST["faculty_status"]);
$instrument = clean_up($_POST["instrument"]);
$background_check = clean_up($_POST["background_check"]);
/* Prepared statement, stage 1: prepare */
if ($addnew) {
    $sql = "INSERT INTO teachers (last_name, first_name, banner_id, home_phone, mobile_phone, email, alternate_email, street_address, city, state, zip_code, faculty_status, instrument, background_check) VALUES ('{$last_name}', '{$first_name}','{$banner_id}','{$home_phone}','{$mobile_phone}','{$email}','{$alternate_email}','{$street_address}','{$city}','{$state}','{$zip_code}','{$faculty_status}','{$instrument}','{$background_check}')";
} else {
    $sql = "UPDATE teachers SET last_name='{$last_name}', first_name='{$first_name}', banner_id='{$banner_id}', home_phone='{$home_phone}', mobile_phone='{$mobile_phone}', email='{$email}', alternate_email='{$alternate_email}', street_address='{$street_address}', city='{$city}', state='{$state}', zip_code='{$zip_code}', faculty_status='{$faculty_status}', instrument='{$instrument}', background_check='{$background_check}' WHERE teacher_key = '{$teacher}'";
}
$link = connectDB();
$results = mysql_db_query("rowanprep", $sql);
if (!$results) {
    echo 'Input failed...<br>';
    echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
$street_address = $_POST["street_address"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip_code = $_POST["zip_code"];
$student_email = $_POST["student_email"];
$parent = $_POST["parent"];
$teacher = $_POST["teacher"];
$classes = $_POST["classes"];
$ensembles = $_POST["ensembles"];
$events = $_POST["events"];
$progress_report_date = $_POST["progress_report_date"];
$photo_release = $_POST["photo_release"];
$home_phone = store_phone($_POST["home_phone"]);
$mobile_phone = store_phone($_POST["mobile_phone"]);
$work_phone = store_phone($_POST["work_phone"]);
$preferred_phone = store_phone($_POST["preferred_phone"]);
$parent_email = $_POST["parent_email"];
$instrument = $_POST["instrument"];
$date_of_birth = $_POST["date_of_birth"];
$starting_date = $_POST["starting_date"];
$enrolled = $_POST['currently_enrolled'];
$notes = $_POST["notes"];
/* Prepared statement, stage 1: prepare */
if ($addnew) {
    $sql = "INSERT INTO students (last_name, first_name, street_address, city, state, zip_code, student_email, parent, teacher, classes, ensembles, events, progress_report_date, photo_release, home_phone, mobile_phone, work_phone, preferred_phone, parent_email, instrument, dob, starting_date, enrolled, notes) VALUES ('{$last_name}', '{$first_name}', '{$street_address}', '{$city}', '{$state}', '{$zip_code}', '{$student_email}', '{$parent}', '{$teacher}', '{$classes}', '{$ensembles}', '{$events}', '{$progress_report_date}', '{$photo_release}', '{$home_phone}', '{$mobile_phone}', '{$work_phone}', '{$preferred_phone}', '{$parent_email}', '{$instrument}', '{$date_of_birth}', '{$starting_date}', '{$currently_enrolled}', '{$notes}')\n\t\t\t";
} else {
    $sql = "UPDATE students SET last_name='{$last_name}', first_name='{$first_name}', street_address='{$street_address}', city='{$city}', state='{$state}', zip_code='{$zip_code}', student_email='{$student_email}', parent='{$parent}', teacher='{$teacher}', classes='{$classes}', ensembles='{$ensembles}', events='{$events}', progress_report_date='{$progress_report_date}', photo_release='{$photo_release}', home_phone='{$home_phone}', mobile_phone='{$mobile_phone}', preferred_phone='{$preferred_phone}', parent_email='{$parent_email}', instrument='{$instrument}', dob='{$date_of_birth}', starting_date='{$starting_date}', enrolled='{$currently_enrolled}', notes='{$notes}' WHERE student_key = '{$student}'";
}
$link = connectDB();
$results = mysql_db_query("rowanprep", $sql);
if (!$results) {
        if (mysql_num_rows($result) !== 0) {
            $addnew = false;
        }
    }
}
//var_dump($_POST);
$first_name = $_POST["first_name"];
$last_name = $_POST["last_name"];
$street_address = $_POST["street_address"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip_code = $_POST["zip_code"];
$email = $_POST["email"];
$banner_id = $_POST["banner_id"];
$home_phone = store_phone($_POST["home_phone"]);
$mobile_phone = store_phone($_POST["mobile_phone"]);
$alternate_email = $_POST["alternate_email"];
$faculty_status = $_POST["faculty_status"];
$instrument = $_POST["instrument"];
$background_check = $_POST["background_check"];
/* Prepared statement, stage 1: prepare */
if ($addnew) {
    $sql = "INSERT INTO teachers (last_name, first_name, banner_id, home_phone, mobile_phone, email, alternate_email, street_address, city, state, zip_code, faculty_status, instrument, background_check) VALUES ('{$last_name}', '{$first_name}','{$banner_id}','{$home_phone}','{$mobile_phone}','{$email}','{$alternate_email}','{$street_address}','{$city}','{$state}','{$zip_code}','{$faculty_status}','{$instrument}','{$background_check}')";
} else {
    $sql = "UPDATE teachers SET last_name='{$last_name}', first_name='{$first_name}', banner_id='{$banner_id}', home_phone='{$home_phone}', mobile_phone='{$mobile_phone}', email='{$email}', alternate_email='{$alternate_email}', street_address='{$street_address}', city='{$city}', state='{$state}', zip_code='{$zip_code}', faculty_status='{$faculty_status}', instrument='{$instrument}', background_check='{$background_check}' WHERE teacher_key = '{$teacher}'";
}
$link = connectDB();
$results = mysql_db_query("rowanprep", $sql);
if (!$results) {
    echo 'Input failed...<br>';
    echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
$street_address = clean_up($_POST["street_address"]);
$city = clean_up($_POST["city"]);
$state = clean_up($_POST["state"]);
$zip_code = clean_up($_POST["zip_code"]);
$student_email = clean_up($_POST["student_email"]);
$parent = clean_up($_POST["parent"]);
$teacher = clean_up($_POST["teacher"]);
$classes = clean_up($_POST["classes"]);
$ensembles = clean_up($_POST["ensembles"]);
$events = clean_up($_POST["events"]);
$progress_report_date = clean_up($_POST["progress_report_date"]);
$photo_release = clean_up($_POST["photo_release"]);
$home_phone = clean_up(store_phone($_POST["home_phone"]));
$mobile_phone = clean_up(store_phone($_POST["mobile_phone"]));
$work_phone = clean_up(store_phone($_POST["work_phone"]));
$preferred_phone = clean_up(store_phone($_POST["preferred_phone"]));
$parent_email = clean_up($_POST["parent_email"]);
$instrument = clean_up($_POST["instrument"]);
$date_of_birth = clean_up($_POST["date_of_birth"]);
$starting_date = clean_up($_POST["starting_date"]);
$enrolled = clean_up($_POST['currently_enrolled']);
$notes = clean_up($_POST["notes"]);
/* Prepared statement, stage 1: prepare */
if ($addnew) {
    $sql = "INSERT INTO students (last_name, first_name, street_address, city, state, zip_code, student_email, parent, teacher, classes, ensembles, events, progress_report_date, photo_release, home_phone, mobile_phone, work_phone, preferred_phone, parent_email, instrument, dob, starting_date, enrolled, notes) VALUES ('{$last_name}', '{$first_name}', '{$street_address}', '{$city}', '{$state}', '{$zip_code}', '{$student_email}', '{$parent}', '{$teacher}', '{$classes}', '{$ensembles}', '{$events}', '{$progress_report_date}', '{$photo_release}', '{$home_phone}', '{$mobile_phone}', '{$work_phone}', '{$preferred_phone}', '{$parent_email}', '{$instrument}', '{$date_of_birth}', '{$starting_date}', '{$currently_enrolled}', '{$notes}')\n\t\t\t";
} else {
    $sql = "UPDATE students SET last_name='{$last_name}', first_name='{$first_name}', street_address='{$street_address}', city='{$city}', state='{$state}', zip_code='{$zip_code}', student_email='{$student_email}', parent='{$parent}', teacher='{$teacher}', classes='{$classes}', ensembles='{$ensembles}', events='{$events}', progress_report_date='{$progress_report_date}', photo_release='{$photo_release}', home_phone='{$home_phone}', mobile_phone='{$mobile_phone}', preferred_phone='{$preferred_phone}', parent_email='{$parent_email}', instrument='{$instrument}', dob='{$date_of_birth}', starting_date='{$starting_date}', enrolled='{$currently_enrolled}', notes='{$notes}' WHERE student_key = '{$student}'";
}
$link = connectDB();
$results = mysql_db_query("rowanprep", $sql);
if (!$results) {