• <bdo id='fWwc3'></bdo><ul id='fWwc3'></ul>
    1. <small id='fWwc3'></small><noframes id='fWwc3'>

      <i id='fWwc3'><tr id='fWwc3'><dt id='fWwc3'><q id='fWwc3'><span id='fWwc3'><b id='fWwc3'><form id='fWwc3'><ins id='fWwc3'></ins><ul id='fWwc3'></ul><sub id='fWwc3'></sub></form><legend id='fWwc3'></legend><bdo id='fWwc3'><pre id='fWwc3'><center id='fWwc3'></center></pre></bdo></b><th id='fWwc3'></th></span></q></dt></tr></i><div id='fWwc3'><tfoot id='fWwc3'></tfoot><dl id='fWwc3'><fieldset id='fWwc3'></fieldset></dl></div>
      <tfoot id='fWwc3'></tfoot>
      1. <legend id='fWwc3'><style id='fWwc3'><dir id='fWwc3'><q id='fWwc3'></q></dir></style></legend>
      2. pdo - 在非对象上调用成员函数 prepare()

        时间:2023-09-21
          <tbody id='IUKdG'></tbody>
          <i id='IUKdG'><tr id='IUKdG'><dt id='IUKdG'><q id='IUKdG'><span id='IUKdG'><b id='IUKdG'><form id='IUKdG'><ins id='IUKdG'></ins><ul id='IUKdG'></ul><sub id='IUKdG'></sub></form><legend id='IUKdG'></legend><bdo id='IUKdG'><pre id='IUKdG'><center id='IUKdG'></center></pre></bdo></b><th id='IUKdG'></th></span></q></dt></tr></i><div id='IUKdG'><tfoot id='IUKdG'></tfoot><dl id='IUKdG'><fieldset id='IUKdG'></fieldset></dl></div>
        1. <small id='IUKdG'></small><noframes id='IUKdG'>

            <tfoot id='IUKdG'></tfoot>

                <legend id='IUKdG'><style id='IUKdG'><dir id='IUKdG'><q id='IUKdG'></q></dir></style></legend>

                  <bdo id='IUKdG'></bdo><ul id='IUKdG'></ul>

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

                  问题描述

                  此代码出现错误:

                  致命错误:在非对象上调用成员函数prepare()C:UsersfelVertrigoServwwwloginvalidation.php 第 42 行

                  Fatal error: Call to a member function prepare() on a non-object in C:UsersfelVertrigoServwwwloginvalidation.php on line 42

                  代码:

                     function repetirDados($email) {
                          if(!empty($_POST['email'])) {
                  
                              $query = "SELECT email FROM users WHERE email = ?";
                  
                              $stmt = $pdo->prepare($query); // error line: line 42
                  
                              $email = mysql_real_escape_string($_POST['email']);
                  
                              $stmt->bindValue(1, $email);
                  
                              $ok = $stmt->execute();
                  
                              $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
                  
                              if ($results == 0) {
                                  return true;
                              } else {
                                  echo '<h1>something</h1>';
                                  return false;
                              }
                          }
                      }
                  

                  可能的原因是什么?另一个问题mysql_num_rows 等价于什么?抱歉,我是 pdo 的新手

                  What is the possible cause? Another question, What is the equivalent to mysql_num_rows? sorry, I am newbie with pdo

                  推荐答案

                  $pdo 未定义.您没有在函数内部声明它,也没有将其作为参数传入.

                  $pdo is undefined. You're not declaring it inside the function, and it isn't being passed in as an argument.

                  您需要将它传入(好),或者在全局命名空间中定义它,并通过将 global $pdo 放在顶部(不好)使其可用于您的函数.

                  You need to either pass it in (good), or define it in the global namespace and make it available to your function by placing global $pdo at the top (bad).

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

                  上一篇:PDO 准备好的语句 - 参数名称中的冒号是做什么用 下一篇:在 pdo 中绑定多个值

                  相关文章

                  最新文章

                    <bdo id='pOWLV'></bdo><ul id='pOWLV'></ul>

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

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

                    1. <tfoot id='pOWLV'></tfoot>

                      <legend id='pOWLV'><style id='pOWLV'><dir id='pOWLV'><q id='pOWLV'></q></dir></style></legend>