<?php

$con = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
$course_id = $request->getAttribute('course_id');
$paper_id = $request->getAttribute('paper_id');


$response=array();


$sql=" select * from faculty where course_id='$course_id' ";
 
 
$result=mysqli_query($con,$sql);

    while ($row[]=mysqli_fetch_assoc($result)) {  

      $user=$row;

	}
	
	foreach($user as $user_data)
	{
	   $user_convert =  json_decode($user_data['papers_managing']);
	   //print_r($user_convert);
	   //echo $user_convert[0];
	   
	   foreach($user_convert as $userlast)
	   {
	     if($userlast == $paper_id)
	     {
	         $user_final[] = $user_data;
	     }
	   }
	}


echo json_encode($user_final);

?>