<div class="col-lg-9 col-md-12">
   <h6 class="py-4 fw-bold">Popular Brands</h6>
   <!--popular-list Begin-->
   <div class="popular-list">
      <ul class="list-inline">
         <?php 
            $sqlcategory="SELECT * FROM  brand_master  ORDER BY rand() LIMIT 4";
                         $myquerycou=$conn->query($sqlcategory);
            $mydaracou= $myquerycou->fetchAll()  ;
            
            $rows_foundcou = $myquerycou->rowCount();
            
            foreach( $mydaracou as $rowcou ){
                  
                    $brand_name = $rowcou["brand_name"]; 
                    $brand_name1=strtolower($brand_name);
                    $brand_name1=str_replace(" " , "-",$brand_name1); 
                     $rows_foundno = $rowcou["total_coupon"]; 
                 $rows_foundoff = $rowcou["total_offers"]; 
            
                   
                    
                       if($brand_name!=''){
                         
            
                   
                    ?>
         <!--brand_name,Coupons, Offers-->
         <li>
            <a href="brand-specific/<?=($brand_name1)?>" class="cat-card">
               <div alt="<?=$brand_name?>" title="<?=$brand_name?>" class="text-truncate popular-img-cat"> 
                  <?=$brand_name ?>
               </div>
               <div class="popular-coupon-offer-bottom">
                  <p class="border-right"><?=$rows_foundno?> Coupons</p>
                  <p><?=$rows_foundoff ?> Offers</p>
               </div>
            </a>
         </li>
         <?php  }    } ?>
      </ul>
   </div>
   <!--popular-list End-->
   <div class="div">
      <h6 class="py-4 fw-bold">Browse All Brands</h6>
      <!-- browse-all -->
      <div class="browse-all">
         <!-- Nav pills -->
         <ul class="nav nav-pills" role="tablist">
            <!-- nav-link browse-all-->
            <li class="nav-item">
               <a class="nav-link active" data-bs-toggle="pill" href="#browse-all">ALL</a>
            </li>
            <!-- nav-link browse-merchant-hatch-->
            <li class="nav-item">
               <a class="nav-link" data-bs-toggle="pill" href="#browse-merchant-hatch">#</a>
            </li>
            <!-- nav-link browse-merchant-a-->
            <?php    foreach( range('a', 'z') as $elements) {  ?> 
            <li class="nav-item">
               <a class="nav-link" data-bs-toggle="pill" href="#browse-merchant-<?=$elements?>"><?=strtoupper($elements)?></a>
            </li>
            <?php } ?>
         </ul>
      </div>
      <!-- Tab panes -->
      <div class="tab-content">
         <!-- Tab pane all-->
         <div id="browse-all" class="tab-pane active">
            <div class="row">
               <?php 
                  $sqlcategory="SELECT * FROM  brand_master ORDER BY rand() LIMIT 100";
                  $myquerycou=$conn->query($sqlcategory);
                  $mydaracou= $myquerycou->fetchAll()  ;
                  
                  $rows_foundcou = $myquerycou->rowCount();
                  
                  foreach( $mydaracou as $rowcou ){
                  
                  $brand_name = addslashes($rowcou["brand_name"]); 
                  $brand_name1=strtolower($brand_name);
                  $brand_name1=str_replace(" " , "-",$brand_name1); 
                   $rows_foundno = $rowcou["total_coupon"]; 
                 $rows_foundoff = $rowcou["total_offers"]; 
                  
                  if($brand_name!=''){
                  
                  
                  ?>
               <div class="col-lg-4 col-6">
                  <!-- coupons-offers-->
                  <div class="coupons-offers">
                     <a href="brand-specific/<?=($brand_name1)?>">
                        <p alt="<?=$brand_name?>" title="<?=$brand_name?>" class="fw-bold text-default"><?=$brand_name?></p>
                        <p> <span><?=$rows_foundno ?> Coupons</span><span><?=$rows_foundoff?> Offers</span> </p>
                     </a>
                  </div>
               </div>
               <?php } } ?>
            </div>
         </div>
         <!-- Tab pane #-->
         <div id="browse-merchant-hatch" class="tab-pane fade">
            <div class="row">
               <?php 
                  $sqlcategory="SELECT * FROM  brand_master WHERE brand_name regexp '^[0-9]+'";
                  $myquerycou=$conn->query($sqlcategory);
                  $mydaracou= $myquerycou->fetchAll()  ;
                  
                  $rows_foundcou = $myquerycou->rowCount();
                  
                  foreach( $mydaracou as $rowcou ){
                  
                  $brand_name = addslashes($rowcou["brand_name"]); 
                  $brand_name1=strtolower($brand_name);
                  $brand_name1=str_replace(" " , "-",$brand_name1); 
                   $rows_foundno = $rowcou["total_coupon"]; 
                 $rows_foundoff = $rowcou["total_offers"]; 
                  
                  if($brand_name!=''){
                   
                  
                  ?>
               <div class="col-lg-4 col-6">
                  <!-- coupons-offers-->
                  <div class="coupons-offers">
                     <a href="brand-specific/<?=($brand_name1)?>">
                        <p alt="<?=$brand_name?>" title="<?=$brand_name?>" class="fw-bold text-default"><?=$brand_name?></p>
                        <p> <span><?=$rows_foundno ?> Coupons</span><span><?=$rows_foundoff?> Offers</span> </p>
                     </a>
                  </div>
               </div>
               <?php } } ?>
            </div>
         </div>
         <!-- Tab pane a-->
         <?php    foreach( range('a', 'z') as $elements) {  ?>
         <div id="browse-merchant-<?=$elements?>" class="tab-pane fade">
            <div class="row">
               <?php 
                  $sqlcategory="SELECT * FROM  brand_master WHERE brand_name LIKE '$elements%'";
                  $myquerycou=$conn->query($sqlcategory);
                  $mydaracou= $myquerycou->fetchAll()  ;
                  
                  $rows_foundcou = $myquerycou->rowCount();
                  
                  foreach( $mydaracou as $rowcou ){
                  
                  $brand_name = addslashes($rowcou["brand_name"]);
                  $brand_name1=strtolower($brand_name);
                  $brand_name1=str_replace(" " , "-",$brand_name1); 
                   $rows_foundno = $rowcou["total_coupon"]; 
                 $rows_foundoff = $rowcou["total_offers"]; 
                  $rows_foundno = 0;
                  $rows_foundoff = 0;
                  if($brand_name!=''){
                  
                  
                  ?>
               <div class="col-lg-4 col-6">
                  <!-- coupons-offers-->
                  <div class="coupons-offers">
                     <a href="brand-specific/<?=($brand_name1)?>">
                        <p alt="<?=$brand_name?>" title="<?=$brand_name?>" class="fw-bold text-default"><?=$brand_name?></p>
                        <p> <span><?=$rows_foundno ?> Coupons</span><span><?=$rows_foundoff?> Offers</span> </p>
                     </a>
                  </div>
               </div>
               <?php } } ?>
            </div>
         </div>
         <?php } ?>
         <!-- tab [pan] -->
      </div>
   </div>
</div>