I have code that worked before so i copied and pasted into new PDO as I am upgrading my website.
It displays all images in one row, even though i have told it after 4th image in row crete new row and sart putting images below the row above.
<?php
$query = 'SELECT * FROM tblgallery_images ';
$stmt = $dbh->prepare($query);
$stmt->execute();
$counter = 0;
$numberperrow = 4;
while($row = $stmt->fetch()) {
$name = $row['imagename'];
if($counter < $numberperrow)
{
echo 'image here';
$counter = $counter + 1;
}else{
echo '<br>';//NEXT ROW INSERTED
$counter = 0;
echo 'image here';
}
}
?>
I need 4 images per row for as many images I have in my table