<?php
    header('Access-Control-Allow-Origin: *');
    header('Access-Control-Allow-Methods: GET, POST');
    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
    include '../../../../config/index.php';
    // $data= file_get_contents('php://input');
   
    // $obj = json_decode($data, true);

    $sql_cm = 'INSERT INTO centerMentors VALUES (NULL,
        "'.$_GET["center_id"].'",
        "'.$_GET["mentor_id"].'",
        "false",
        now())';
    if (mysqli_query($conn, $sql_cm)) {
        $centerMentors_id = mysqli_insert_id($conn);
        $sql_10="SELECT * FROM teachers WHERE center_id='".$_GET["center_id"]."'";
        $result_10 = mysqli_query($conn, $sql_10);  
        if (mysqli_num_rows($result_10) > 0) {
            while($row_10 = mysqli_fetch_assoc($result_10)) {
            $sql_tc = 'INSERT INTO MentorTeachers VALUES (NULL,
                "'.$centerMentors_id.'",
                "'.$row_10['teacher_id'].'",
                "false",
                now())';
            if (mysqli_query($conn, $sql_tc)) {
            }
            }
        }
        $curl_post_data = array(
            'Success' => 'true',
            'centerMentors_id' => $centerMentors_id,
        );
        echo json_encode($curl_post_data);
    
    } 

   

?>