title: insert data and return it as json
body: <p>I have below code, which is inserting data into a mysql database. However when the data is added i want to return this row as json. Is it possible to get this from the current insert query or would i have to make a new select query and if yes, then how do i retrieve the added id from this insert query?</p>
  
  <pre><code>$stmt = $db-&gt;prepare("INSERT INTO camps (title, body, longitude, latitude, image) VALUES (?, ?, ?, ?, ?)");
  $stmt-&gt;bind_param('ssdds', $title, $body, $longitude, $latitude, $link);
  $stmt-&gt;execute();
  </code></pre>