Master Page w/Images from each Post
So my problem is hopfully simple. My master page which lists all the "Newest Posts" includes the following: Title, Description (1st sentence), Link to details page, and an Image. The problem is that I have multiple images linked with every "Post", so it posts it more than once. For example one I have 3 images of and it posts all 3 different images but the same title, description and link.
How can I overcome this to have it only grab the 1st image associated with the post? And how can I have the text and description "float" over the image. As everything is in one <p> and just loops.
In my functions.php
function getAllPosts($read) {
$sql = 'SELECT *
FROM posts
INNER JOIN post2photo USING (post_id)
INNER JOIN photos USING (photo_id)
ORDER BY created DESC';
return $read->fetchAll($sql);
}
In my Master.php
$feature = getAllPosts($dbRead);
<?php foreach ($feature as $post) { ?>
<p>
<?php echo $post['name']; ?>:
<?php echo['description'] ?>
<span id="places"><img src=".../image_upload/<?php echo $post['filename']; ?>" width="400" /></span>
<a href="detail.php?place=<?php eco $post['link_name']; ?>">More</a>
</p>
<?php } ?>