php - Bootstrap 4 Modal is not working Inside Slick carousel div

one text

Solution:

I think you should move the modal code parts outside of your carousel parts like this:

<?php
 $ush = $mysqli->prepare("SELECT company_id, img, name from list");
 $ush->execute();
 $ush->store_result();
 $ush->bind_result($u_bid, $u_bimg,$u_bname);
 
$carousel_content = '';
$modal_content = '';
while($ush->fetch()){
 $carousel_content .= '<div>
  <a href="#'.$u_bid.'" data-toggle="modal" data-target="#'.$u_bid.'"><img 
 src="data:image/png;base64,'.base64_encode($u_bimg).'" height="80px" width="80px"></a>    
 </div>';
 $modal_content .= '<!-- Modal -->
 <div class="modal" id="'.$u_bid.'" tabindex="-1" role="dialog" aria-labelledby="'.$u_bid.'" aria-hidden="true">
   <div class="modal-dialog modal-dialog-centered modal-md" role="document">
     <div class="modal-content">
       <div class="modal-body">
         <div class="container text-center">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><h3><b>X</b></h3></span>
          </button>
          <h3>'.$u_bname.'</h3> 
         </div>
       </div>
      </div>
    </div>
   </div>';
?>

 <?php
 }
   $ush->close();
 ?>
 <div class="company-logo"><?=$carousel_content?></div>

 <div id="modal_contents"><?=$modal_content?></div>

 <script type="text/javascript">
     $(document).ready(function(){
      $('.company-logo').slick({
              dots:true,
              infinite:false,
              speed:300,
              slidesToShow:14,
              slidesToScroll:14,
              arrows:false,
              responsive:[{
                      breakpoint:768,
                      settings:{
                                slidesToShow:4,
                                slidesToScroll:4
                               }
                     }]
              })
           });
  </script>

Source