INSERT-绑定变量的数量;t匹配准备语句中的字段数


INSERT - Number of bind variables doesn't match number of fields in prepared statement

我得到了:

警告:mysqli_stmt::bind_result():绑定变量的数量不匹配中已准备语句中的字段数E: 第73行上的''XAMPP''htdocs''account''lib''register.php

当我使用这个代码:

if($stmt = $conn -> prepare("INSERT INTO login(user, pass) VALUES(?, ?)")) {
  /* Bind parameters s - string, b - blob, i - int, etc */
  $stmt -> bind_param("ss", $user, $pw);
  /* Execute it */
  $stmt -> execute();
  /* Bind results */
  $stmt -> bind_result($user, $pw);
  /* Close statement */
  $stmt -> close();
  $userId = $conn->insert_id;
} 

我不明白,为什么每次都会发生这种情况,我的代码片段出了什么问题?

您正在尝试对不返回任何结果的语句执行bind_result

拆下此管路。$stmt -> bind_result($user, $pw);