'wyslane']); } else { echo json_encode(['status'=>'blad']); } } if($_SERVER['REQUEST_METHOD'] == "GET" && isset($_GET['type'])){ $ans = mysqli_query($con, "SELECT * FROM zdj"); $json = array(); while($row = mysqli_fetch_assoc($ans)){ $json[] = $row; } echo json_encode($json); } if($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET["id"])){ $ans = mysqli_query($con, "SELECT zdj FROM zdj WHERE id = ". $_GET["id"]); $json = array(); if($ans){ while($row = mysqli_fetch_assoc($ans)){ $json[] = $row; } echo json_encode($json); } else { echo json_encode(["status"=>"nie ma danych"]); } } ?>