<legend id='5K8sH'><style id='5K8sH'><dir id='5K8sH'><q id='5K8sH'></q></dir></style></legend>
  • <small id='5K8sH'></small><noframes id='5K8sH'>

    1. <tfoot id='5K8sH'></tfoot>

      • <bdo id='5K8sH'></bdo><ul id='5K8sH'></ul>
    2. <i id='5K8sH'><tr id='5K8sH'><dt id='5K8sH'><q id='5K8sH'><span id='5K8sH'><b id='5K8sH'><form id='5K8sH'><ins id='5K8sH'></ins><ul id='5K8sH'></ul><sub id='5K8sH'></sub></form><legend id='5K8sH'></legend><bdo id='5K8sH'><pre id='5K8sH'><center id='5K8sH'></center></pre></bdo></b><th id='5K8sH'></th></span></q></dt></tr></i><div id='5K8sH'><tfoot id='5K8sH'></tfoot><dl id='5K8sH'><fieldset id='5K8sH'></fieldset></dl></div>

      1. 在布尔值上调用成员函数 bind_param()

        时间:2023-09-25
        <i id='SAG7m'><tr id='SAG7m'><dt id='SAG7m'><q id='SAG7m'><span id='SAG7m'><b id='SAG7m'><form id='SAG7m'><ins id='SAG7m'></ins><ul id='SAG7m'></ul><sub id='SAG7m'></sub></form><legend id='SAG7m'></legend><bdo id='SAG7m'><pre id='SAG7m'><center id='SAG7m'></center></pre></bdo></b><th id='SAG7m'></th></span></q></dt></tr></i><div id='SAG7m'><tfoot id='SAG7m'></tfoot><dl id='SAG7m'><fieldset id='SAG7m'></fieldset></dl></div>

        <small id='SAG7m'></small><noframes id='SAG7m'>

        <tfoot id='SAG7m'></tfoot>
          <legend id='SAG7m'><style id='SAG7m'><dir id='SAG7m'><q id='SAG7m'></q></dir></style></legend>
              <tbody id='SAG7m'></tbody>

                • <bdo id='SAG7m'></bdo><ul id='SAG7m'></ul>
                  本文介绍了在布尔值上调用成员函数 bind_param()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我尝试在php中将参数绑定到sql(mysqli),但是出现上面写的错误代码.这是我写的代码:

                  I try to bind parameters to sql (mysqli) in php, but there is an error code as written above. This is the code I wrote:

                  $stmt = $conn->prepare("INSERT INTO assignments (Classes_has_Subjects_classesHasSubjectsId, assignmentName, gradeForAssignment,protectiveGrade) 
                                                    VALUES (?, ?, ?, ?)");
                  if ($stmt = false)
                  {
                      echo "false";
                  }
                  else{
                      $stmt->bind_param("sss", $classesHasSubjectsId, $assignmentName, $gradeForAssignment,  $protectiveGrade);
                      $stmt->execute();
                  }
                  

                  这里是错误信息:11

                  致命错误:在布尔值上调用成员函数 bind_param()

                  Fatal error: Call to a member function bind_param() on boolean in

                  怎么了?

                  推荐答案

                  <?php
                  $stmt = $conn->prepare("INSERT INTO assignments (Classes_has_Subjects_classesHasSubjectsId, assignmentName, gradeForAssignment,protectiveGrade) 
                                                    VALUES (?, ?, ?, ?)");
                      if (!$stmt) {
                          echo "false";
                      }
                      else {
                          $stmt->bind_param("ssss", $classesHasSubjectsId, $assignmentName, $gradeForAssignment,  $protectiveGrade);
                          $stmt->execute();
                      }
                  

                  if ($stmt = false) 表示您将 false 分配给 $stmt.将其替换为 if (!$stmt).

                  if ($stmt = false) means you're assigning false to $stmt. Replace it with if (!$stmt).

                  您绑定了 4 个参数,但只提供了 3 种类型的值.我在 bind_param 函数中添加了一个 s,假设您的所有值都是字符串.如果某些值是整数,则用 i 替换相应的 s.如果有双打,替换为 d.

                  You're binding 4 parameters but only providing 3 types of values. I added a s in the bind_param function, assuming all your values are string. If some of the values are integers replace the corresponding s with an i. If there are doubles, replace with a d.

                  您确定 assignments 表中第一个字段的名称是 Classes_has_Subjects_classesHasSubjectsId?

                  Are you sure the first field's name in the assignments table is Classes_has_Subjects_classesHasSubjectsId?

                  这篇关于在布尔值上调用成员函数 bind_param()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:real_escape_string 与准备好的语句 下一篇:如何将 PDO 转换为 mysqli?

                  相关文章

                  最新文章

                • <small id='4IBEv'></small><noframes id='4IBEv'>

                  • <bdo id='4IBEv'></bdo><ul id='4IBEv'></ul>

                  1. <legend id='4IBEv'><style id='4IBEv'><dir id='4IBEv'><q id='4IBEv'></q></dir></style></legend>

                      <i id='4IBEv'><tr id='4IBEv'><dt id='4IBEv'><q id='4IBEv'><span id='4IBEv'><b id='4IBEv'><form id='4IBEv'><ins id='4IBEv'></ins><ul id='4IBEv'></ul><sub id='4IBEv'></sub></form><legend id='4IBEv'></legend><bdo id='4IBEv'><pre id='4IBEv'><center id='4IBEv'></center></pre></bdo></b><th id='4IBEv'></th></span></q></dt></tr></i><div id='4IBEv'><tfoot id='4IBEv'></tfoot><dl id='4IBEv'><fieldset id='4IBEv'></fieldset></dl></div>
                      <tfoot id='4IBEv'></tfoot>