<?php


include '../Connection.php';

$id = $_REQUEST['id'];
$status = array();
$category = array();
if(isset($id))
{
    $query = "select * from services where id=$id";

    $res = mysqli_query($sqlconnection, $query);
    
    while($row = mysqli_fetch_assoc($res))
    {
        $query2 = "SELECT u.first_name,u.last_name,u.profile_image,s.id FROM `users` u JOIN `services` s ON u.id=s.vendor_id having s.id=$id";
        $result = mysqli_query($sqlconnection, $query2);
        
        while($row1 = mysqli_fetch_assoc($result))
        {
            array_push($category, $row1);
        }
        
         $row['details'] = $category;
         
        array_push($status, $row);
        
    }
    
    echo json_encode(array("response_status"=>"true","Services"=>$status));
    http_response_code(200);

}
 else
  {
      echo json_encode(array("response_status"=>"false"));
      http_response_code(400);
}