• <legend id='2dfbp'><style id='2dfbp'><dir id='2dfbp'><q id='2dfbp'></q></dir></style></legend>

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

      <tfoot id='2dfbp'></tfoot>
      1. <small id='2dfbp'></small><noframes id='2dfbp'>

      2. PHP 代码 (mysqli) 查询在特定代码后不起作用

        时间:2023-09-24
        • <bdo id='HmnJ2'></bdo><ul id='HmnJ2'></ul>

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

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

              • <legend id='HmnJ2'><style id='HmnJ2'><dir id='HmnJ2'><q id='HmnJ2'></q></dir></style></legend>

                    <tbody id='HmnJ2'></tbody>
                • 本文介绍了PHP 代码 (mysqli) 查询在特定代码后不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有 PHP 代码,我们可以将此代码称为 BLOCKONE:

                  $maker = "从视频信息中选择 vidMaker";如果 ($result = mysqli_query($con, $maker)) {而 ($row = mysqli_fetch_row($result)) {$values = expand(',',$row[0]);foreach($values as $v)如果 (!empty($v)) {printf ("<img class="makerImg" src="addVid/maker/%s.jpg">", $v);}}mysqli_free_result($result);}别的{echo "PM 管理员出错";}

                  我有很大的 PHP 代码,例如:

                   <头><身体><?php>............块...........?>

                  问题是BLOCKONE 之前 BLOCKONE 所有的mysqli 查询都在工作,我可以显示信息、图像等,但是AFTER BLOCKONE 没有任何查询在工作.

                  为什么我知道这个问题正是在这段代码中?因为如果删除它......完整的代码工作正常.而且我不确定要解决它.

                  这是完整的代码:

                  <头><meta http-equiv="content-type" content="text/html; charset=utf-8"><?php 包含 'BSH.php' ?><link rel="stylesheet" type="text/css" href="CSS/ldvid.css"><script type="text/javascript" src="java/FWDUVPlayer.js"></script><!-- 设置视频播放器--><script type="text/javascript"><?php 包含 'video/settings.php';?><身体><?php include_once 'userPages/check_login_status.php';?><?php include_once 'incIndex/headerTop.php';?><?php include_once 'incIndex/footer.php';?><?php//这里我们得到传入的视频 ID (videoinfo.php?id=123)$video_id = $_GET['id'];//建立一个数据库查询来选择视频信息//这里我们使用WHERE来选择我们想要的video_id$query = 'SELECT newsvid.id, videoinformation.id, videomain.id, newsvid.vidTitle, newsvid.imgCover, videoinformation.vidLD, videoinformation.vidYear, videoinformation.vidCity, videoinformation.vidZanr, videoinformation.vidZanr2,videoinformation.vidZanr3,videoinformation.vidQuality, videoinformation.vidTranslated, videoinformation.vidMaker, videoinformation.vidRoles, videoinformation.vidTime, videoinformation.imgShot1, videoinformation.imgShot2, videoinformation.imgShot3, videomain.vidMUrl from newsvid, videomain, videoinformation WHERE newsvid.id = videoinformation.id AND newsvid.id = videomain.id AND newsvid.id = '.$video_id ;//让我们连接并执行查询包括'connect/con.php';$result = mysqli_query($con, $query);echo "

                  ";while($row = mysqli_fetch_array($result)) {echo "<div class="panel panel-default"><div class="panel-heading">";回声<div><strong><h3>".$row['id'].|".$row['vidTitle'] ."</h3></strong></div>";echo "</div><div class="panel-body">";echo "<div class="imgCover"><img style="width:200;height:320px" class="img-thumbnail"src="upload/videoCover/" . $row['imgCover'] . ""></div>";echo "

                  <表格><tr><td class="tdBR"><strong>年份:</strong></td><td>" . $row['vidYear'] . "</td></tr><tr><td class="tdBR"><strong>城市:</strong></td><td>".$row['vidCity']."</td></tr><tr><td class="tdBR"><strong>Zanr: </strong></td><td >". $row['vidZanr'] .", ". $row['vidZanr2'] .", ". $row['vidZanr3'] . "</td></tr><tr><td class="tdBR"><strong>质量:</strong></td><td>". $row['vidQuality'] ."</td></tr><tr><td class="tdBR"><strong>翻译:</strong></td><td>". $row['vidTranslated'] ."</td></tr><tr><td class="tdBR"><strong>视频时间:</strong></td><td>".$row['vidTime']."</td></tr></table>" . $row['vidLD'] . "</div></div>";echo "<div class="panel-body" style="border-top: 1px solid;边框底部:1px 实心;边框颜色:#ddd"><div class="vidDesc">

                  ";echo "

                  <div><strong>制造商:</strong>" . $row['vidMaker'] . "</div><div>";$maker = "SELECT vidMaker FROM videoinformation WHERE id=".$row['id'];如果 ($result = mysqli_query($con, $maker)) {而 ($row = mysqli_fetch_row($result)) {$values = expand(',',$row[0]);foreach($values as $v)如果 (!empty($v)) {printf ("<img class="makerImg img-circle" src="addVid/maker/%s.jpg">", $v);}}mysqli_free_result($result);}别的{echo "PM 管理员出错";}回声</div><div><strong>角色:</strong>".$row['vidRoles'] .</div><div><表格>";$role = "从视频信息中选择 vidRoles WHERE id=".$row['id'];如果 ($result = mysqli_query($con, $role)) {而 ($row = mysqli_fetch_row($result)) {$values = expand(',',$row[0]);foreach($values as $v)如果 (!empty($v)) {printf ("<img class="roleImg img-circle" src="addVid/roles/%s.jpg">", $v);}}mysqli_free_result($result);}别的{echo "PM 管理员出错";}echo "</table></div></div></div>";echo"<div class="panel-body"><div class="screenshots">";echo "<div class="imgShot1"><img style="width:245px;height:140px" class="img-thumbnail" src="upload/" . $row['imgShot1'] . ""></div>";echo "<div class="imgShot2"><img style="width:245px;height:140px" class="img-thumbnail" src="upload/" . $row['imgShot2'] . ""></div>";echo "<div class="imgShot3"><img style="width:245px;height:140px" class="img-thumbnail" src="upload/" . $row['imgShot3'] . ""></div>";回声"</div>";echo "</div><div class="panel-footer">";echo "

                  <div id="myDiv"></div><ul id="playlists" style="display:none;"><li data-source="playlist1" data-playlist-name="MY HTML PLAYLIST" data-thumbnail-path="content/thumbnails/large1.jpg"></li></ul><ul id="playlist1" style="display:none;"><li data-thumb-source="content/thumbnails/small-fwd.jpg" data-video-source="".$row['vidMUrl'] ."" data-poster-source="upload/videoCover/" .$row['imgCover'] ."" 数据可下载="是"></li></ul>

                  ";回声</div></div></div>";}mysqli_close($con);?>

                  解决方案

                  你假设得到不止一行,但你总是重写:

                  while ($row = mysqli_fetch_array($result)) {

                  在你的主循环中,你总是重写你的 $result$row 变量.

                  在while循环内,使用$result2$row2.

                  I have PHP code we can call this code BLOCKONE:

                  $maker = "SELECT vidMaker FROM videoinformation";
                  if ($result = mysqli_query($con, $maker)) {
                      while ($row = mysqli_fetch_row($result)) {
                          $values = explode(',',$row[0]);
                          foreach($values as $v)
                          if (!empty($v)) {
                             printf ("<img class="makerImg" src="addVid/maker/%s.jpg">", $v);
                          }
                      }
                      mysqli_free_result($result);
                  
                  }
                  else{
                      echo"PM administrator with an error";
                  }
                  

                  I have big PHP code like:

                      <!DOCTYPE html>
                      <head>
                      </head>
                  
                      <body>
                      <?php>
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      BLOCKONE
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      .
                      ?>
                      </body>
                  
                  </html>
                  

                  The question is BEFORE BLOCKONE all the mysqli queries are working, I can display information, images and so on, but AFTER BLOCKONE none of the queries are working.

                  Why I know that the problem exactly in this code? Because if delete it... full code working fine. And I'm not sure hot to solve it.

                  This is full code:

                  <!DOCTYPE html>
                  <head>
                  <meta http-equiv="content-type" content="text/html; charset=utf-8">
                  <?php include 'BSH.php' ?>
                  <link rel="stylesheet" type="text/css" href="CSS/ldvid.css">
                  <script type="text/javascript" src="java/FWDUVPlayer.js"></script>
                  
                          <!-- Setup video player-->
                          <script type="text/javascript">
                          <?php include 'video/settings.php'; ?>
                          </script>
                  
                  </head>
                  <body>
                  
                  
                  <?php include_once 'userPages/check_login_status.php';?>
                  <?php include_once 'incIndex/headerTop.php'; ?>
                  <?php include_once 'incIndex/footer.php'; ?>
                  
                  <?php
                  
                  // here we get the incomming video id (videoinfo.php?id=123)
                  $video_id = $_GET['id'];
                  
                  // build a database query to select the videoInformation
                  // here we use WHERE to select the video_id we want
                  $query = 'SELECT newsvid.id, videoinformation.id, videomain.id, newsvid.vidTitle, newsvid.imgCover, videoinformation.vidLD, videoinformation.vidYear, videoinformation.vidCity, videoinformation.vidZanr, videoinformation.vidZanr2,videoinformation.vidZanr3,videoinformation.vidQuality, videoinformation.vidTranslated, videoinformation.vidMaker, videoinformation.vidRoles, videoinformation.vidTime, videoinformation.imgShot1, videoinformation.imgShot2, videoinformation.imgShot3, videomain.vidMUrl FROM newsvid, videomain, videoinformation WHERE newsvid.id = videoinformation.id AND newsvid.id = videomain.id AND newsvid.id = '. $video_id ;
                  
                  // lets connect and do the query
                  include 'connect/con.php';
                  $result = mysqli_query($con, $query);
                  
                  
                  echo "<div class="ldCover">"; 
                  
                  while($row = mysqli_fetch_array($result)) {
                  
                  echo "<div class="panel panel-default"><div class="panel-heading">";
                  echo "<div><strong><h3>" . $row['id']. " | " . $row['vidTitle'] . "</h3></strong></div>";
                  
                  echo "</div><div class="panel-body">";
                  echo "<div class="imgCover"><img style="width:200; height:320px" class="img-thumbnail"src="upload/videoCover/" . $row['imgCover'] . ""></div>";
                  echo "<div class="vidLD">
                  <table>
                  <tr><td class="tdBR"><strong> Years: </strong></td><td >" . $row['vidYear'] . "</td></tr>
                  <tr><td class="tdBR"><strong> City: </strong></td><td >". $row['vidCity'] . "</td></tr>
                  <tr><td class="tdBR"><strong> Zanr: </strong></td><td >". $row['vidZanr'] ." , ". $row['vidZanr2'] ." , ". $row['vidZanr3'] . "</td></tr>
                  <tr><td class="tdBR"><strong> Quality: </strong></td><td >". $row['vidQuality'] . "</td></tr>
                  <tr><td class="tdBR"><strong> Translated: </strong></td><td >". $row['vidTranslated'] . "</td></tr>
                  <tr><td class="tdBR"><strong> Video time: </strong></td><td >". $row['vidTime'] .  "</td></tr>
                  
                  </table>" . $row['vidLD'] . "</div></div>";
                  
                  
                   echo "<div class="panel-body" style="border-top: 1px solid; border-bottom: 1px solid; border-color:#ddd"><div class="vidDesc">
                   </div>";
                  
                  
                   echo "<div class="vidMR">
                  <div><strong> Maker: </strong>" . $row['vidMaker'] . "</div><div>";
                  
                  $maker = "SELECT vidMaker FROM videoinformation WHERE id=".$row['id'];
                  if ($result = mysqli_query($con, $maker)) {
                      while ($row = mysqli_fetch_row($result)) {
                          $values = explode(',',$row[0]);
                          foreach($values as $v)
                          if (!empty($v)) {
                             printf ("<img class="makerImg img-circle" src="addVid/maker/%s.jpg">", $v);
                          }
                      }
                      mysqli_free_result($result);
                  
                  }
                  else{
                      echo"PM administrator with an error";
                  }
                  
                  echo"</div><div><strong> Roles: </strong>". $row['vidRoles'] . "</div>
                  <div><table>";
                  $role = "SELECT vidRoles FROM videoinformation WHERE id=".$row['id'];
                  if ($result = mysqli_query($con, $role)) {
                      while ($row = mysqli_fetch_row($result)) {
                          $values = explode(',',$row[0]);
                          foreach($values as $v)
                          if (!empty($v)) {
                             printf ("<img class="roleImg img-circle" src="addVid/roles/%s.jpg">", $v);
                          }
                      }
                      mysqli_free_result($result);
                  
                  }
                  else{
                      echo"PM administrator with an error";
                  }
                  echo "</table></div></div></div>";
                  
                  echo"<div class="panel-body"><div class="screenshots">";
                   echo "<div class="imgShot1"><img style="width:245px; height:140px" class="img-thumbnail" src="upload/" . $row['imgShot1'] . ""></div>";
                   echo "<div class="imgShot2"><img style="width:245px; height:140px" class="img-thumbnail" src="upload/" . $row['imgShot2'] . ""></div>";
                   echo "<div class="imgShot3"><img style="width:245px; height:140px" class="img-thumbnail" src="upload/" . $row['imgShot3'] . ""></div>";
                  echo"</div>";
                  
                  
                  echo "</div><div class="panel-footer">";
                  echo "<div class="vidMUrl"> 
                  
                   <div id="myDiv"></div>
                  
                  <ul id="playlists" style="display:none;">
                  <li data-source="playlist1" data-playlist-name="MY HTML PLAYLIST" data-thumbnail-path="content/thumbnails/large1.jpg">
                  </li></ul>
                  
                  <ul id="playlist1" style="display:none;">
                  <li data-thumb-source="content/thumbnails/small-fwd.jpg" data-video-source="". $row['vidMUrl'] . "" data-poster-source="upload/videoCover/" . $row['imgCover'] . "" data-downloadable="yes">
                  </li></ul>
                  
                   </div>";
                  
                  
                  echo "</div></div></div>";
                  }
                  mysqli_close($con);
                  
                  ?>
                  
                  
                  
                  
                  
                  
                  
                  
                  </body>
                  </html>
                  

                  解决方案

                  You are assuming to get more than one row, but you are always rewriting that:

                  while ($row = mysqli_fetch_array($result)) {
                  

                  In your main loop, you are always rewrite your $result and $row variable.

                  Inside the while loop, use $result2, and $row2.

                  这篇关于PHP 代码 (mysqli) 查询在特定代码后不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:MySQLi num_rows 返回 0 下一篇:将数组转换为单独的字符串

                  相关文章

                  最新文章

                    <bdo id='4OZSn'></bdo><ul id='4OZSn'></ul>
                  <tfoot id='4OZSn'></tfoot>
                • <small id='4OZSn'></small><noframes id='4OZSn'>

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

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