So I have a gallery web page showing all user's folders that contains images (Something like Behance or Pinterest):
<div id="project_display">
<?php
$img_title_display = mysqli_query($db, "SELECT DISTINCT title, description, category FROM images WHERE user_id='$user_id' ORDER BY title");
while($row = $img_title_display->fetch_assoc())
{
?>
<a href="#openModal2" id="Modal"><p><?php echo ($row['title']);?></p></a>
<?php
}
?>
</div>
Then, after clicking on any folder, the modal window appears and you can see folder's content:
<div id="openModal2" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<?php
$img_desc_display = mysqli_query($db, "SELECT DISTINCT title, description, category FROM images WHERE user_id='$user_id' ORDER BY title");
$img_details=mysqli_fetch_array($img_desc_display,MYSQLI_ASSOC);
?>
<h2><?php echo ($img_details['title']); ?></h2><br/>
<p><?php echo($img_details['description']); ?></p>
<p><?php echo($img_details['category']); ?></p>
</div></div>
The problem is that now in each folder it shows the same content (first row from the database). How to specify the link so that each folder had an appropriate content?