Im wondering what can I do to make images from a database on Php display on my page. This is what I have
images .php
$query = "SELECT * FROM images ORDER BY name ASC ";
$result = $db->query($query);
$num_result = $result->num_rows;
echo "<h1> Images</h1>";
for ($i = 0; $i < $num_result; $i++){
$row = $result->fetch_assoc();
$name = $row['name'];
$URL = $row['imageURL'];
$array = array($URL);
}
foreach ($array as $image){
echo '<tr>';
echo '<td><img class="coupons" src="'.$image.'"/></td>';
echo '<td></td>';
echo '</tr>';
echo '<tr>';
}
This is just printing only one image and I have 10 in my database, what can I do or change to print all of the images from the database? Thanks