使用自举滑块显示图像(PHP&Mysq)l

问题描述 投票:-1回答:1

我需要一些帮助...我只是想使用滑块来获取图像,并且代码仅显示任何内容而没有显示错误,我试图找到问题,但是我对问题的原因一无所知。有人可以帮忙吗?

我的表名称是WallkTalk,这是以下列:idWalltalkWallDescriptionFileName(路径图像),iduser [fk]

这是代码:

<!--******************************************************************************************-->
<!-- The Modal -->
<div class="modal" id="myModal">
  <div class="modal-dialog">
    <div class="modal-content">

      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">Modal Heading</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>

      <!-- Modal body -->
      <div class="modal-body">
      <div id="demo" class="carousel slide" data-ride="carousel">

          <!-- Indicators -->
      <ul class="carousel-indicators">
             <?php 
                $i = 0;
                $IdUser = $_SESSION["IdUser"];

                $result = $conn->query("SELECT W.WallDescription as text, W.FileName as Pic 
                FROM  Wall_Talk W
                WHERE  A0_User_IdUser =  $IdUser ");
                foreach($result as $row)
                {
                    $actives ="";

                    if($i == 0)
                    {
                        $actives = 'active';
                    }
            ?>
                     <li data-target="#demo" data-slide-to="<?= $i;?>" class="<?= $actives;?>"></li>
                      <?php  $i++;

                 }?>
        </ul>

          <!-- The slideshow -->
          <div class="carousel-inner">
          <?php 
            $i = 0;

            foreach($result as $row)
            {
                $actives ="";

                if($i == 0)
                {
                    $actives = 'active';
                }

          ?>
            <div class="carousel-item <?= $actives;  ?>">
               <img src="<?= $row['Pic'] ?>" width="100%" height="400px;">
               <p><?= $row['text']?></p>
            </div>
            <?php $i++;
          }?>
          </div>

          <!-- Left and right controls -->
          <a class="carousel-control-prev" href="#demo" data-slide="prev">
            <span class="carousel-control-prev-icon"></span>
          </a>
          <a class="carousel-control-next" href="#demo" data-slide="next">
            <span class="carousel-control-next-icon"></span>
          </a>

          </div>
                </div>

      <!-- Modal footer -->
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
      </div>

    </div>
  </div>
</div>
php mysql session pdo
1个回答
-1
投票

if($ i = 0)应该是if($ i == 0)

© www.soinside.com 2019 - 2024. All rights reserved.