How to display image from database in PHP?
Display image from database in PHP
First, you can upload images in the database.
Code -:
- imageshow.php
- <?php
- $con = mysqli_connect("localhost", "root" ,"", "testing");
- if($con) {
- //database conneciton done
- $qry = "SELECT * FROM `image upload`";
- $run = mysqli_query($con, $qry);
- if($run) {
- while($data = mysqli_fetch_assoc($run)) {
- ?>
- <img src="images/<?php echo $data['image_name'] ?>" width="100px">
- <br><br>
- <?php
- }
- }
- }
- ?>
Table link -: https://drive.google.com/file/d/1iNDI8i2ODtZ_bpGuYsJlqv-MsPkmQGJ3/view?usp=sharing
No comments