Display Images From a Local Directory in PHP

Viewed 54

I am trying to get the File Name of the Images form database and want to insert in a page. I am inserting images to a local folder and store the names in the database. Need to retrieve it and.

            <?php
            global $DBConnect;
            $Query = "SELECT * FROM posts ORDER BY datetime DESC ";
            $Execute = mysqli_query($DBConnect,$Query);

            while ($DataRows = mysqli_fetch_array($Execute)){
                $PostID = $DataRows["id"];
                $DateTime = $DataRows["datetime"];
                $Category = $DataRows["category"];
                $Author = ["author"];
                $Image = ["image"];
                $Post = $DataRows["post"];
            ?>
           <div class="thumbnail">
               <img src="uploads/<?php echo $Image;?>">
           </div>
            <?php }?>      
1 Answers

I didn't fetch the image using $DataRows. Its was my Mistake..!

$Image = $DataRows["image"];
Related