PDO response to json
<p>Im new to PHP and trying to make a very simple api (good way too learn i think), why doesnt this work?
When loading this page the output is: <strong><em>{"queryString":"SELECT id, Name FROM Food WHERE userID=1 ORDER BY Name"}</em></strong> and not the JSON-string that I want</p>

<pre><code>$dbh = new PDO("mysql:host=$hostname;dbname=$dbname", $username, $password);

$response = $dbh-&gt;query("SELECT id, Name FROM Food WHERE userID=1 ORDER BY Name");

$responseJSON = json_encode($response);

header('Content-type: application/json');
echo "$responseJSON";

$dbh = null;
</code></pre>

<p>Nothing is wrong with the query because i get what i want when trying this:</p>

<pre><code>$dbh = new PDO("mysql:host=$hostname;dbname=$dbname", $username, $password);

$response = $dbh-&gt;query("SELECT id, Name FROM Food WHERE userID=1 ORDER BY Name");

    foreach ($response as $row)
        {
            print $row['Name'] . ' ';
        }


$dbh = null;
</code></pre>

<p>outputs:
<em>Bacon
Cheese
chips</em></p>
