У меня есть несколько изображений в моей базе данных, и все они соответствуют одному и тому же идентификатору проекта.
Я хочу, чтобы они отображались рядом друг с другом в браузере.
Но следующий код выводит только последнее изображение, а не все из них:
//get all the images in this project and add them to the content variable for output
if (!empty($FormProjectID)) {
$DBQuery3 = mysqli_query($dblink, "SELECT * FROM images WHERE project_id = '$FormProjectID'");
if (mysqli_num_rows($DBQuery3) < 1) {
$content = '
This project is empty. Upload some files to get started.
';
} else {
while($row = mysqli_fetch_array($DBQuery3)) {
$DBImageID = $row['image_id'];
$DBProjectID = $row['project_id'];
$DBImageName = $row['image_name'];
$DBImageDescription = $row['image_description'];
$DBDateCreated = $row['date_created'];
$DBLinkToFile = $row['link_to_file'];
$DBGivenName = $row['given_name'];
//if the image was given a name by the user, display it
//otherwise display the generated name
if (strlen($DBGivenName) > 1) {
$FileName = $DBGivenName;
} else {
$FileName = $DBImageName;
}
$content = '
';
}
}
Как мне получить все изображение, чтобы в итоге html выглядел так:
Позже на моей html-странице у меня есть: