<tfoot id='xb5rU'></tfoot>
  • <legend id='xb5rU'><style id='xb5rU'><dir id='xb5rU'><q id='xb5rU'></q></dir></style></legend>
      <bdo id='xb5rU'></bdo><ul id='xb5rU'></ul>

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

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

        如何在另一个查询的 while 循环中运行 sql 查询

        时间:2023-09-20

        1. <small id='ek5uN'></small><noframes id='ek5uN'>

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

                  本文介绍了如何在另一个查询的 while 循环中运行 sql 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  当 photoId 直接在语句上而不是变量时,以下工作完全没有问题.

                  The following works with no problem at all, when the photoId is directly on the statement and not a variable.

                  $img_query = mysqli_query($con, 'SELECT * FROM imgs WHERE photoid = "103"') or die(mysqli_error($con));
                  

                  但是下面的操作不会出错,可能是什么原因导致无法选择.

                  but the following just won't work with no error, what might be causing this not to select.

                  $imageid = '103';
                  $img_query = mysqli_query($con, 'SELECT * FROM imgs WHERE photoid = "$imageid"') or die(mysqli_error($con));
                  $img_row = mysqli_fetch_array($img_query);
                      echo $img_row['img'];
                  

                  这是一个while循环.

                  This is inside a while loop.

                  while($row = mysqli_fetch_array($somequery)){
                   $imageid = $row['photoid'];
                      $img_query = mysqli_query($con, 'SELECT * FROM imgs WHERE photoid = "$imageid"') or die(mysqli_error($con));
                      $img_row = mysqli_fetch_array($img_query);
                          echo $img_row['img'];
                  }
                  

                  谢谢.

                  推荐答案

                  在php中'"差别很大,查询语法是双引号左右变量周围的查询和单引号......尽管我建议您在查询中使用参数,而不是直接将变量放入查询中

                  in php a ' and a " are very different and the query syntax is double quote around the query and single quote around variables.. although I would recommend you look at using parameters on your query instead of just putting a variable directly into the query

                  $imageid = '103';
                  $query = $con->prepare("SELECT * FROM imgs WHERE photoid = ?");
                  $query->bind_param('sssd', $imageid);
                  $query->execute();
                  

                  这只是它的细节......如果你想了解更多关于连接的信息......错误处理和其他一切阅读DOCS

                  this is just the nuts and bolts of it... if you want more information about the connection.. error handling and everything else read the DOCS

                  这篇关于如何在另一个查询的 while 循环中运行 sql 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP数组转换成Javascript数组 下一篇:循环时我无法在里面创建 num 行

                  相关文章

                  最新文章

                    • <bdo id='a8OyQ'></bdo><ul id='a8OyQ'></ul>

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

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

                    2. <i id='a8OyQ'><tr id='a8OyQ'><dt id='a8OyQ'><q id='a8OyQ'><span id='a8OyQ'><b id='a8OyQ'><form id='a8OyQ'><ins id='a8OyQ'></ins><ul id='a8OyQ'></ul><sub id='a8OyQ'></sub></form><legend id='a8OyQ'></legend><bdo id='a8OyQ'><pre id='a8OyQ'><center id='a8OyQ'></center></pre></bdo></b><th id='a8OyQ'></th></span></q></dt></tr></i><div id='a8OyQ'><tfoot id='a8OyQ'></tfoot><dl id='a8OyQ'><fieldset id='a8OyQ'></fieldset></dl></div>
                    3. <small id='a8OyQ'></small><noframes id='a8OyQ'>