<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Card</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-3">
<div class="card">
<div class="card-body">
<img src="https://tipsmake.com/data1/thumbs/how-to-extract-img-files-in-windows-10-thumb-bzxI4IDgg.jpg" class="w-100">
<h5>Sample Img</h5>
</div>
</div>
</div>
<div class="col-3">
<div class="card">
<div class="card-body">
<img src="https://tipsmake.com/data1/thumbs/how-to-extract-img-files-in-windows-10-thumb-bzxI4IDgg.jpg" class="w-100">
<h5>Sample Img</h5>
</div>
</div>
</div>
<div class="col-3">
<div class="card">
<div class="card-body">
<img src="https://tipsmake.com/data1/thumbs/how-to-extract-img-files-in-windows-10-thumb-bzxI4IDgg.jpg" class="w-100">
<h5>Sample Img</h5>
</div>
</div>
</div>
<div class="col-3">
<div class="card">
<div class="card-body">
<img src="https://tipsmake.com/data1/thumbs/how-to-extract-img-files-in-windows-10-thumb-bzxI4IDgg.jpg" class="w-100">
<h5>Sample Img</h5>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
this is simple example your want too this
try this also above code
<div class="col-3">
<div class="card">
<div class="card-body">
<img src="https://tipsmake.com/data1/thumbs/how-to-extract-img-files-in-windows-10-thumb-bzxI4IDgg.jpg" class="w-100">
<h5>Sample Img</h5>
</div>
</div>
</div>
above code just put only your while loop
3
solved How to align Bootstrap cards horizontally in PHP