I am trying to send back the last inserted id after I insert some data into my database. I am successfully entering the data into the database, but there is no response data being sent back. I am using Php PDO and it is hosted on Google App Engine and my headers are set to application/json in the dbconnect.php file. What do I need to add to make it successfully send back response data.
<?php
require('dbconnect.php');
$statement=$con->prepare('INSERT INTO customers (fname, lname) VALUES (:fname,:lname)');
$statement->execute(array(':fname' => $_POST['fname'], ':lname' => $_POST['lname'] ));
$orderId = $statement->lastInsertId();
$json = $json_encode($orderId);
echo $json;
$con = null;
?>