<bdo id='0Hqft'></bdo><ul id='0Hqft'></ul>

  • <i id='0Hqft'><tr id='0Hqft'><dt id='0Hqft'><q id='0Hqft'><span id='0Hqft'><b id='0Hqft'><form id='0Hqft'><ins id='0Hqft'></ins><ul id='0Hqft'></ul><sub id='0Hqft'></sub></form><legend id='0Hqft'></legend><bdo id='0Hqft'><pre id='0Hqft'><center id='0Hqft'></center></pre></bdo></b><th id='0Hqft'></th></span></q></dt></tr></i><div id='0Hqft'><tfoot id='0Hqft'></tfoot><dl id='0Hqft'><fieldset id='0Hqft'></fieldset></dl></div>
  • <legend id='0Hqft'><style id='0Hqft'><dir id='0Hqft'><q id='0Hqft'></q></dir></style></legend>

        <small id='0Hqft'></small><noframes id='0Hqft'>

      1. <tfoot id='0Hqft'></tfoot>

        在非对象上调用成员函数 bind_param().mysqli

        Call to a member function bind_param() on a non-object. mysqli(在非对象上调用成员函数 bind_param().mysqli)
        <legend id='DkHrj'><style id='DkHrj'><dir id='DkHrj'><q id='DkHrj'></q></dir></style></legend>

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

              <tbody id='DkHrj'></tbody>

              <bdo id='DkHrj'></bdo><ul id='DkHrj'></ul>
            • <small id='DkHrj'></small><noframes id='DkHrj'>

                1. 本文介绍了在非对象上调用成员函数 bind_param().mysqli的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是我的 php 代码:

                  include ("dbinfo.php");if(isset($_POST['editsave'])){$edittitle=$_POST["edittitle"];$editurl=$_POST["editurl"];$editdesc=$_POST["editdesc"];$editid=$_POST["editid"];$mysqli = $GLOBALS['dbc'];$stmt = $mysqli->prepare("更新链接 SET title = ?,描述 = ?哪里 id = ?");$stmt->bind_param('ssd',$_POST['edittitle'],$_POST['editdesc'],$_POST['editid']);$stmt->执行();$stmt->close();}

                  这是我的表格:

                   <form role="form" action="edit.php" method="post"><div class="form-group"><label for="title">标题</label>
                  <input type="hidden" name="editid" value="<?echo $id; ?>"><button type="submit" name="editsave" class="btn btn-primary">保存更改</button></div></表格>

                  当我按下提交时,我得到这个:

                  致命错误:在第 27 行的/storage/content/x/xxx/中的非对象上调用成员函数 bind_param().

                  第 27 行是:

                  $stmt->bind_param('ssd',

                  我不熟悉mysqli.我已经尝试解决这个问题几天了,但我快疯了.

                  解决方案

                  这表示里面的查询 mysqli::prepare() 导致错误.

                  根据文档:

                  <块引用>

                  mysqli_prepare() 返回一个语句对象,如果发生错误则返回 FALSE.

                  尝试正确转义 desc,这是 MySQL 中的保留关键字( 不是正确转义):

                  $stmt = $mysqli->prepare('UPDATE links SET title = ?, `desc` = ? WHERE id = ?');

                  This is my php code:

                  include ("dbinfo.php");
                  
                  if(isset($_POST['editsave'])){
                  $edittitle=$_POST["edittitle"];
                  $editurl=$_POST["editurl"];
                  $editdesc=$_POST["editdesc"];
                  $editid=$_POST["editid"];
                  
                  $mysqli = $GLOBALS['dbc'];
                  $stmt = $mysqli->prepare("UPDATE links SET title = ?, 
                    desc = ? 
                    WHERE id = ?");
                  $stmt->bind_param('ssd',
                    $_POST['edittitle'],
                    $_POST['editdesc'],
                    $_POST['editid']);
                  $stmt->execute();
                  $stmt->close();
                  }
                  

                  This is my form:

                      <form role="form" action="edit.php" method="post">
                      <div class="form-group">
                        <label for="title">Title</label>
                        <input type="text" name="edittitle" class="form-control" id="title" placeholder="Enter title" maxlength="70" value="<?php echo ($title); ?>">
                      </div>
                      <div class="form-group">
                        <label for="url">URL</label>
                        <input type="text" name="editurl" class="form-control" id="url" value="<?php echo ($url); ?>" disabled>
                      </div>
                      <div class="form-group">
                        <label for="desc">Description</label><small> (max 500 characters)</small>
                        <textarea class="form-control" name="editdesc" id="desc" rows="5" maxlength="500"><?php echo ($desc); ?></textarea>
                      </div>
                      <div>
                        <input type="hidden" name="editid" value="<? echo $id; ?>">
                        <button type="submit" name="editsave" class="btn btn-primary">Save changes</button>
                      </div>
                    </form>
                  

                  When i press submit i get this:

                  Fatal error: Call to a member function bind_param() on a non-object in /storage/content/x/xxx/ on line 27.

                  Line 27 is:

                  $stmt->bind_param('ssd',
                  

                  I'm not familiar with mysqli. I have tried to fix the problem for a few days now and I'm getting crazy.

                  解决方案

                  This means that the query inside mysqli::prepare() resulted in an error.

                  According to the doc:

                  mysqli_prepare() returns a statement object or FALSE if an error occurred.

                  Try to properly escape desc, which is a reserved keyword in MySQL ( is not proper escaping):

                  $stmt = $mysqli->prepare('UPDATE links SET title = ?, `desc` = ? WHERE id = ?');
                  

                  这篇关于在非对象上调用成员函数 bind_param().mysqli的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <bdo id='UjRmK'></bdo><ul id='UjRmK'></ul>
                  • <small id='UjRmK'></small><noframes id='UjRmK'>

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

                    <tfoot id='UjRmK'></tfoot>
                        <tbody id='UjRmK'></tbody>