<?php
require_once __DIR__ . '/db_config.php';
$r = array();
$r["list"]= array();

if (isset($_POST["id"]) ) {
 $id=$_POST["id"];

$con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());

$query="SELECT a.question,a.answer,a.imagepath,a.issue,c.category,sc.subcategory
    FROM answerstable a
    INNER JOIN dynamicquestionscategory c ON a.category=c.id
    LEFT JOIN dynamicquestionssubcategory sc ON a.subcategory = sc.id
    WHERE a.assignschedule_id='$id'";

    mysqli_query($con,'SET CHARACTER SET utf8');

    $result=mysqli_query($con,$query);
    if(!empty($result) && mysqli_num_rows($result) > 0){
        $r["list"] = mysqli_fetch_all($result,MYSQLI_ASSOC);
    }
}
echo json_encode($r);


?>