我正在尝试在更新请求后进行其余api支持 获取请求工作正常,但我不能使更新工作,我尝试了几个小时:(,代码应该没有框架
try {
if (isset($_POST['title']) && isset($_GET['id'])) {
$title = $_POST['title'];
$text = $_POST['text'];
$date = $_POST['date'];
$news = $connection->prepare("UPDATE news SET title = '" . $title . "', text ='" . $text . "', date = '" . $date . "' WHERE id = " . $_GET['id']);
$news->execute();
}
$result = $news;
if ($result != 0) {
$result = array('success' => 1);
return $result;
output($result);
};
} catch (PDOException $e) {
if (!$inProduction) {
throw new pdoDbException($e);
} else {
output(['Error occured' => 'Please try again!']);
}
}