ok

Mini Shell

Direktori : /proc/self/root/home2/selectio/www/thedentalpark.com/admin/api/
Upload File :
Current File : //proc/self/root/home2/selectio/www/thedentalpark.com/admin/api/get-value.php

<?php include"../config/config.php";


if (isset($_POST['field_type']) && $_POST['field_type'] == "get_course") {

    // Validate college_id
    $college_id = isset($_POST['college_id']) ? $_POST['college_id'] : '';

    if (empty($college_id)) {
        $response['status'] = 'failed';
        $response['message'] = 'College ID is required!';
        echo json_encode($response);
        exit;
    }

    
    try {
        $statement = $pdo->prepare("SELECT * FROM `tbl_course` WHERE college_id = ? AND status = ?");
        $statement->execute(array($college_id, 1));
        $result = $statement->fetchAll(PDO::FETCH_ASSOC);
        $totalrow = $statement->rowCount();

        if ($totalrow > 0) {
            $response['status'] = 'success';
            $response['message'] = 'Course Details Fetched Successfully';
            $response['courses'] = $result;
        } else {
            $response['status'] = 'failed';
            $response['message'] = 'Course Details Not Found!';
        }

    } catch (Exception $e) {
        $response['status'] = 'failed';
        $response['message'] = 'Error occurred: ' . $e->getMessage();
    }

    // Send the response as JSON
    echo json_encode($response);
}


if (isset($_POST['field_type']) && $_POST['field_type'] == "get_course_specialization") {

    // Validate college_id
    $college_id = isset($_POST['college_id']) ? $_POST['college_id'] : '';
    $course_id = isset($_POST['course_id']) ? $_POST['course_id'] : '';

    if (empty($college_id)) {
        $response['status'] = 'failed';
        $response['message'] = 'College ID is required!';
        echo json_encode($response);
        exit;
    }

    if (empty($course_id)) {
            $response['status'] = 'failed';
            $response['message'] = 'Course ID is required!';
            echo json_encode($response);
            exit;
    }

    
    try {
        $statement = $pdo->prepare("SELECT * FROM `tbl_course_specialization` WHERE college_id = ? AND course_id=? AND status = ?");
        $statement->execute(array($college_id, $course_id, 1));
        $result = $statement->fetchAll(PDO::FETCH_ASSOC);
        $totalrow = $statement->rowCount();

        if ($totalrow > 0) {
            $response['status'] = 'success';
            $response['message'] = 'Course Specialization Details Fetched Successfully';
            $response['courses'] = $result;
        } else {
            $response['status'] = 'failed';
            $response['message'] = 'Course Specialization Details Not Found!';
        }

    } catch (Exception $e) {
        $response['status'] = 'failed';
        $response['message'] = 'Error occurred: ' . $e->getMessage();
    }

    // Send the response as JSON
    echo json_encode($response);
}

?>

Zerion Mini Shell 1.0