Display value in While only in the first record

Asked

Viewed 42 times

0

I’m doing a while, but I need the value to be displayed active only in the first item <div class="item ACTIVE">.

<div class="carousel-inner">
  <?php $exibir = "active"; do { ?>
  <div class="item ACTIVE">
    <h1 class="title">
      <?php echo $row_rsBanner["titulo"]; ?>
      <span class="subtitle"><?php echo $row_rsBanner["mensagem"]; ?></span></h1>
    <div class="car-img">
      <img src="img/car1.png" class="img-responsive" alt="car1">
    </div>
  </div>
  <?php } while ($row_rsBanner = $rsBanner->fetch_assoc()); ?>
</div>

How to display only on the first loop and the others not?

Thank you.

1 answer

1


Wow, if it’s what I’m thinking it’s pretty simple, put a $i = 0; out of the while, when it goes into the while you put $i++, where you want to show the value you put

if($i == 1){<div></div>}
  • Can you help me with that? https://answall.com/questions/366909/whire-entre-hora-inicial-e-final-com-m%C3%Baltiplos-de-30-minutes

Browser other questions tagged

You are not signed in. Login or sign up in order to post.