Alright, so I am currently working on a website and for a section of the website I am trying to display some data from an SQL database. And I want the data to display in a such a way as seen here:
<div class="project-list">
<ul>
<?php
try {
$stmt = $db->query('SELECT movieID, movieName, movieDesc, movieYear FROM latest ORDER BY movieID DESC');
while($row = $stmt->fetch()){
echo '<li>';
echo '<a href="#" class="no-underline">';
echo '<div class="project">';
echo '<h2 class="project-date">'.$row['movieYear'].'</h2>';
echo '<div class="poster"><img src="assets/img/FoTD_Poster.png" width="160" height="188"></div>';
echo '<h2 class="project-title" align="center"><b>'.$row['movieName'].'</b></h2>';
echo '</a>';
echo '</div>';
echo '</li>';
echo '<li>';
}
} catch(PDOException $e) {
echo $e->getMessage();
}
?>
</ul>
</div>
Essentially this is supposed to display a record, and it does however, my issue is that the way my style sheet is setup is it will only allow for three project divs to display per project-list/row. And I can't quite figure out how to make it so I can only display 3 records per this div and reset with PHP.
See Question&Answers more detail:os