<?php
include '../../conn.php';

$msg='';//$_GET['message'];
$review=$_GET['review'];
$userid=$_GET['userid'];
$doctorid=$_GET['doctorid'];

$totalUserRating=null;
$noOfUserRating=null;
$resultdata =$con->query("select * from `feedback` where doctorId=$doctorid and userId=$userid");
   $rowno=0;
   while($row=mysqli_fetch_array($resultdata))
    {
        $rowno=1;
    }
 if($rowno == 1) {
     $j->status  = "102";
     $j->message = "Review Already Submited";
 }
else{
$insert = $con->query("INSERT INTO `feedback`(`message`, `rating`, `userId`, `doctorId`)VALUES('$review','$review','$userid','$doctorid')");
if($insert > 0){
          
$j->status  = "101";
$j->message = "Success";

}
else{
$j->status  = "104";
$j->message = "wrong";
}
}
echo json_encode($j); 
?>