i wanted to know how can i display the images like the on in the picture: i know that i have to retrive the images using a while loop, but then displaying them like this is the
Displaying the image is a matter of using the html tag, and you can use the modulo operator
%
to know when you've displayed X images so you can close the existing row and open a new one.
$images ; //array of image urls
$countImages = count($images) ;
$imagesPerRow = 5 ;
for ($i = 0 ; $i < $countImages; $i++) {
//display image here
$image = $images[$i] ;
echo "" ;
if ($i % $imagesPerRow == 0) {
//have displayed an entire row
echo '
' ;
}
}
Modulo returns the remainder of the division. So, lets say you want rows of 5 images. If $i is divided by 5 exactly then the remainder will be 0, which means 5 imageshave been shown so it's time for a new row.