<?php
    include($_SERVER['DOCUMENT_ROOT'] ."/_ps2020/config/connect.php");
    include_once($_SERVER['DOCUMENT_ROOT'].'/_ps2020/_global/dir_root.php');

    session_start();

    $sid = $_GET["sid"];
    $newCode = $_GET["newCode"];

    // $code_exist = false;

    //  $result = $conn->query("SELECT * FROM school WHERE specific_teacherCode = ".$newCode);
    //     if($result) {
    //         if($result->num_rows > 0){
    //             $code_exist = true;
    //         }
    //         else
    //             $code_exist = false;
    //     }

    if ($conn->query("UPDATE school SET specific_teacherCode='".$newCode."' WHERE school_id='".$sid."'") === TRUE) {
        echo 1;
    }
    else {
        echo 0;
    }
?>