Hi I am facing some issues on Post Method
My code
function signup() {
$request = \Slim\Slim::getInstance()->request();
$update = json_decode($request->getBody());
$sql = "INSERT INTO updates (title,link) VALUES (:title, :link)";
try {
$db = getDB();
$stmt = $db->prepare($sql);
$stmt->bindParam("title", $update->title);
$stmt->bindParam("link", $update->link);
$time=time();
$stmt->execute();
$update->id = $db->lastInsertId();
$db = null;
echo json_encode($update);
}
catch(PDOException $e) {
echo '{"error":{"text":'. $e->getMessage() .'}}';
}
}
it saved as null on database and json result Null (Using Postman) Status getting 200