As refer to my previous posting mission, I finally manage to create a simple image gallery and the most significant thing is that, images are sorted in table manner.
I used the arithmetics function MOD logic to help me to sort the images. In PHP, MOD can be represented as % and I used the MOD of $i+ % 5 since it will render incremental numbers i.e 1,2,3,4,5 and so on.
Number 5 will determine the number of column that you will get in your table. You can change this to other number such as 7 as long as the outcomes are 1,2,3,4,5 and so on.
The PHP codes are