Hey all i need a little help with slim framework not binding parameters properly
i have copied a tutorial script and changed a few variables to suit my system
I do this becaus ei am still learning so as i have moved away from letting dreamweaver do it for me
i still use an ide but code it instead of let dw do it for me so far GET Method works like a dream so does Delete
post and put seem to be setting the parameter as null. i have tried using a chrome app thats a restful client i have tried with curl.
but it always sets the parameter as null.
below is the function for my update method could somebody please shine a light on what could be the issue.
My enviroment is win7 ultimate with netbeans 8 and xampp for windows with php5.
function updateVacancy($id) {
$request = Slim\Slim::getInstance()->request();
$body = $request->getBody();
$vacancy = json_decode($body);
$sql = "UPDATE hr_vacancies SET title=:title WHERE id=:id";
try {
$db = getConnection();
$stmt = $db->prepare($sql);
$stmt->bindParam("title", $vacancy->title);
$stmt->bindParam("id", $id);
$stmt->execute();
$db = null;
echo json_encode($vacancy);
} catch(PDOException $e) {
echo '{"error":{"text":'. $e->getMessage() .'}}';
}
}
Any help would be greatly apreciated i have a feeling it's something to do with the tutorial being on a different version of php and slim framework.