title: Appropriate way to output SQL Result Array in JSON
body: <p>I'm outputting my DB result like this:</p>
  
  <pre><code>foreach($result as $row) {
      echo json_encode($row);
  }
  </code></pre>
  
  <p>This outputs the following:</p>
  
  <pre><code>{"nummer":"600","name":"Location Name 600"}{"nummer":"698","name":"Location Name 698"}{"nummer":"1110","name":"Location Name 1110"}
  </code></pre>
  
  <p>Is this the right way? Do I have to seperate the result rows from each other?</p>
  
  <p>Edit: If I get a callback id from jquery, what way would I format this into jsonp? To be more specific, I'd like to put an value containing the total amount of results, and then all results found, in jsonp (jquery sends me the id for a callback, which I'll have to put into the output).</p>