I have a folder unit_images
that is full of images with random names except they have a prefix that corresponds to a PRIMARY KEY
in a db table.
1_4534534fw4.jpg
2_43534tw4t45.png
You get my point. I am using YoxView to view images and am doing something like this:
<?php
$query = "SELECT id FROM images WHERE unit = ".$_GET['id']."";
$result = mysqli_query($con, $query);
echo '<div class="yoxview">';
while ($row = mysqli_fetch_assoc($result))
{
echo '<img src="unit_images/01.jpg" alt="First" title="First image" />
<img src="unit_images/02.jpg" alt="Second" title="Second image" />'
}
echo '</div>';
?>
I want to list the images from my folder unit_images
WHERE the unit is the one currently being shown.I just do not know how to tell PHP the filename. I want to do something similar to a 1_%
in SQL. Does that make sense? Since I do not know what the rest of the filename looks like I just need to tell php it doesn't matter.