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


    $sqlcpn="SELECT * FROM course_lesson_plan WHERE course_id='".$_GET["course_id"]."' ";
    $resultcpn = mysqli_query($conn, $sqlcpn); 
    if (mysqli_num_rows($resultcpn) > 0) {
        while($rowcpn = mysqli_fetch_assoc($resultcpn)) {
            $assignment ;
            $sql10="SELECT * FROM course_lesson_assignment WHERE course_lesson_plan_id='".$rowcpn["course_lesson_plan_id"]."' ";
        
            $result10 = mysqli_query($conn, $sql10); 
            if (mysqli_num_rows($result10) > 0) {
                while($row10 = mysqli_fetch_assoc($result10)) {
                    $assignment =  $row10["assignment"];
                    
                }
            }
            $curl_post_data = array(
                'course_lesson_plan_id' => $rowcpn["course_lesson_plan_id"],
                'course_id' => $rowcpn["course_id"],
                'lesson_session' => $rowcpn["lesson_session"],
                'lesson_topic' => $rowcpn["lesson_topic"],
                'lesson_sub_topic' => $rowcpn["lesson_sub_topic"],
                'assignment' => $assignment,
            );
            
            array_push($data, $curl_post_data);
        }
    }


    echo json_encode($data);
 


?>