0
我想做一個SQL更新。如何檢查記錄是否已更新?
當我試圖更新它時,我收到消息Updated! ($ action_succeed)但它不會在數據庫中更新...
任何想法有什麼不對?
我的代碼...
<form action="title.php" method="post" autocomplete="off">
Article ID<input type="text" name="edit_article_id" />
New Title<input type="text" name="edit_article_title" />
<input type="submit" value="OK" /><br /><br />
</form>
if (isset($_POST['edit_article_id'], $_POST['edit_article_title'])) {
$id = $_POST['edit_article_id'];
$title = ($_POST['edit_article_title']);
if (empty($id) or empty($title)) {
$error_failed = 'Failed, please fill in all of the fields';
} else {
$query = $db->prepare('UPDATE articles (article_title) VALUES (?) WHERE (article_id) VALUES (?)');
$query->bindValue(1, $title);
$query->bindValue(2, $id);
$action_succeed = 'Updated!';
$query->execute();
}
}