first li active in while loop in php mysql

<?php
  $sql="SELECT * from `shiksha_testimonial` where featured=1 order by testimonial_id DESC";
   $result=mysqli_query($con,$sql);
   $num_rows=mysqli_num_rows($result);
   if($num_rows > 0)
   {
   $i=0;
  while($row=mysqli_fetch_array($result))
                    {
                   ?> 
              <div class="item carousel-item <?php if($i==0) {
     $i=1;
     echo 'active'; } ?>">
                <div class="img-box"><img src="<?php echo $base_url ?>/uploads/testimonial/<?php echo $row['client_img']; ?>" alt=""></div>
                <p class="testimonial"><?php echo mb_strimwidth($row['client_description'], 0, 100, "."); ?> </p>
                 <p class="overview"><b><?php echo $row['client_name']; ?></b>,<?php echo $row['client_designation']; ?></p>
              </div>
              <?php }
  $i++;
          }
   ?>

Comments

Popular posts from this blog

dynamic create multiple ckeditor onclick event using jquery

get lat and long from city name using jquery

membership registration and login system in php