I have a web service that queries a database for a region and then returns the results in JSON format. It works but it is not displaying things like "400 bad request" when a bad request is made. The page just displays;
[]
Why is this? I thought apache had built in HTTP error code handling. What I want the script to do is when a bad request is made or a 404 error is occured, to return the specific code.
Here is my php script;
<?php
$a = $_GET["region"];
$conn = new PDO ("mysql:host=localhost;dbname=***;", "***",
"***");
$results = $conn->query("SELECT * FROM pointsofinterest WHERE region='$a'");
$resultsAsAssocArray = $results->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($resultsAsAssocArray);
?>