使用设置值更新mysqli查询

时间:2013-03-02 15:50:18

标签: php mysqli

我可以动态更新我的列,但我不知道如何使用设置值更新它(我知道这很愚蠢)

这是我的sql代码,用设置值更新列:

if (isset($_POST['delete'])) {
$sql = 'UPDATE users SET user_deletion_date = NOW(), user_deleted_by = '.$_SESSION['id'].', deleted = Y
          WHERE user_id = ?';
  if ($stmt->prepare($sql)) {
    // bind the query parameters
    $stmt->bind_param('i', $_GET['user_id']);
    // bind the result to variables
    $stmt->bind_result($user_id, $user_deletion_date, $user_deleted_by, $deleted);
    // execute the query, and fetch the result
    $done = $stmt->execute();
    $stmt->fetch();
  }
}
if ($done) {
  header('Location: update_users_confirm.php');
  exit;
}

这根本没有更新表格,我知道问题出在我的bind_param上,有人可以帮忙吗

1 个答案:

答案 0 :(得分:0)

迈克尔B的回答很可能是解决方案。将$ _GET更改为$ _POST

相关问题