php - 我更新时出现错误消息

标签 php html mysql sql

Hello everyone?! When I change the value of my texboxes, I have this kind of error. Click to see the image.

这也是我的代码。我不知道到底发生了什么事。我希望有人能帮助我解决这个问题。先感谢您。 :(

<!--Update-->
<?php
  include "config.php";
  include "header.php";
  if(isset($_GET['u'])):
    if(isset($_POST['bts'])):
      $stmt = $mysqli->prepare("UPDATE personal SET id_personal=?, name=?, date=?, datepaid=?, amount=? WHERE id_personal=?");
      $stmt->bind_param('sssss', $id, $en, $date, $dp, $amnt);

      $id = $_POST['id'];
      $en = $_POST['en'];
      $date = $_POST['date'];
      $dp = $_POST['dp'];
      $amnt = $_POST['amnt'];

      if($stmt->execute()):
        echo "<script>location.href='index.php'</script>";
      else:
        echo "<script>alert('".$stmt->error."')</script>";
      endif;
    endif;
    $res = $mysqli->query("SELECT * FROM personal WHERE id_personal=".$_GET['u']);
    $row = $res->fetch_assoc();
?>

最佳答案

错误非常明显“变量数量与参数数量不匹配”。

您的“$stmt->bind_param()”应该有六个变量,因为您在“$mysqli->prepare()”中的6个位置引用了变量陈述。

关于php - 我更新时出现错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39565731/

相关文章:

php - 如何在 PHP 中获取有用的错误消息?

php - 不使用 php 的电子邮件表单提交

mysql - 数据类型和查询速度

javascript - jQuery AJAX 分页不起作用

php - Symfony 清除缓存后的所有空白页

javascript - 如何使用 html 分割可变长度字段

html - CSS div 容器垂直对齐

html - 下拉菜单在延伸到其容器的长度时被裁剪

mysql - 如何将Datagridview中当前选定的行插入到数据库

MYSQL - 邮政编码半径 - 优化并返回到外部选择的距离