How to fetch image and data from DB to Website

0
83
index.php

<h2 class="my-3">
Purchase Your Products
</h2>
<p>
Find all your products here.
</p>
<div class="row">
<?php

require '../database/dbconfig.php';

$query = "select * from products";
$query_run = mysqli_query($connection,$query);

$check_products = mysqli_num_rows($query_run) > 0;

if($check_products)
{
   while($row= mysqli_fetch_array($query_run))
   
   {
       ?>
<div class="col-md-6 col-lg-4 my-3">
<div class="card">
<div class="card-body">
<a href="../productlogin.php"><img src="../admin panel/upload/<?php echo $row['image']; ?>" widht="300" height="200" class="mb-3" alt=""></a>
<div class="row">
<div class="col">
<h3 class="card-title">₹<?php echo $row['productprize']; ?></h3>
</div>
<div class="col text-right">
<div class="btn-group">
<a href="../appointment-scheduling/index.html" class="btn btn-outline-primary">Details</a>
<button  onclick="window.location.href = '../productlogin.php';"  id="item_4051" data-flow-id="1" class="btn btn-outline-success" data-cf-modified-28015ab68b7211e8355327ac-="">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-cart"><circle cx="9" cy="21" r="1"></circle><circle cx="20" cy="21" r="1"></circle><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path></svg>
</button>
</div>
</div>
</div>
<p class="card-text mt-3" style="font-size: 16px;"><?php echo $row['productname']; ?></p>
</div>
</div>
</div>
       <?php

   }
}
else
{
 echo "no product found";
}

?>

</div>
</div>
</div>
dbconfig.php

<?php

$server_name = "localhost";
$db_username = "root";
$db_password = "";
$db_name = "billing";

$connection = mysqli_connect($server_name,$db_username,$db_password,$db_name);


?>

LEAVE A REPLY

Please enter your comment!
Please enter your name here