<?php
$con = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

$course_id = $request->getAttribute('course_id');
$papers_shortcode = $request->getAttribute('papers_shortcode');
$exams_id = $request->getAttribute('exams_id');

$count = 0;

if(isset($course_id) && isset($exams_id) && isset($papers_shortcode)){

$sql="SELECT * FROM pwi_submit WHERE course_id='$course_id' AND exams_id='$exams_id' AND process='2' 
AND papers_shortcode like '%".$papers_shortcode."%' ";

 print_r($sql);

$result=mysqli_query($con,$sql);

while($row=mysqli_fetch_assoc($result)){
$count += count(json_decode($row['roll_number'],true));

}
}

echo json_encode($count);

?>