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

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

        <tfoot id='KMG14'></tfoot>
          <bdo id='KMG14'></bdo><ul id='KMG14'></ul>

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

        mysqli 准备语句中带有 fetch_array 的 SELECT 语句

        时间:2023-07-30

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

              <legend id='xXPWY'><style id='xXPWY'><dir id='xXPWY'><q id='xXPWY'></q></dir></style></legend>
                <tfoot id='xXPWY'></tfoot>

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

                  <bdo id='xXPWY'></bdo><ul id='xXPWY'></ul>
                    <tbody id='xXPWY'></tbody>

                • 本文介绍了mysqli 准备语句中带有 fetch_array 的 SELECT 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我总是发现编写 MySQLi 准备好的语句很困难,因为许多函数的工作方式与旧方式不同.现在我正面临一个关于 fetch_array() 的问题.

                  I always find it difficult to write MySQLi prepared statements, because many functions work differently than in the old way. Right now I am facing a problem regarding fetch_array().

                  $stmt = $db->prepare("SELECT category_id FROM post_items Where user_id = ?");
                  $stmt->bind_param('i', $userid);
                  $result = $stmt->execute();
                  while ($row = $result->fetch_array()) {
                      // ...
                  }
                  

                  推荐答案

                  您正在尝试通过

                  $result = $stmt->execute();
                  

                  事实并非如此.因为 execute 只会返回一个布尔值.

                  which is not the case. as execute will return you only a boolean value.

                  喜欢就好.

                  $stmt = $db->prepare("SELECT category_id FROM post_items Where user_id = ?");
                  $stmt->bind_param('i', $userid);
                  $stmt->execute();
                  $result = $stmt->get_result();
                  while ($row = $result->fetch_assoc()) {
                          //result is in row
                  }
                  

                  这篇关于mysqli 准备语句中带有 fetch_array 的 SELECT 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:“没有为准备好的语句中的参数提供数据" 下一篇:如何解决 PHP 中的“无法通过引用传递参数"

                  相关文章

                  最新文章

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

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

                      • <bdo id='tQfw0'></bdo><ul id='tQfw0'></ul>
                    1. <tfoot id='tQfw0'></tfoot>