<?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 = array();
    


    $sql="SELECT * FROM course_lesson_plan WHERE course_lesson_plan_id='".$_GET["course_lesson_plan_id"]."' ";
    $result = mysqli_query($conn, $sql);  
    if (mysqli_num_rows($result) > 0) {
        while($row = mysqli_fetch_assoc($result)) {
   
            $sql_g="SELECT * FROM courses WHERE course_id='".$row["course_id"]."'";
            $result_g = mysqli_query($conn, $sql_g);  
            if (mysqli_num_rows($result_g) > 0) {
                while($row_g = mysqli_fetch_assoc($result_g)) {
                    $curl_post_data = array(
                        'lesson_session' => $row["lesson_session"] ,
                        'course_id' => $row_g["course_id"] ,
                        'course_name' => $row_g["course_name"] ,
                        'course_image' => $row_g["course_image"] ,
                        'course_description' => $row_g["course_description"] ,
                        'expected_outcome' => $row_g["expected_outcome"] ,
                        'delivery_mode' => $row_g["delivery_mode"] ,
                        'minimum_age' => $row_g["minimum_age"] ,
                        'required_sessions' => $row_g["required_sessions"] ,
                        'active' => $row_g["active"] ,
                    );
                    array_push($data, $curl_post_data );
                }
            }


  
        }
    }



    echo json_encode($data);
?>