Skip to content
Advertisement

php add a counter in while loop and return to a new line when i reach this counter

this is my code:

now this code works fine, but it echo my results on the same line since its a loop.

i want my output to be 3 photos per line for example: image1 image2 image3 (jumps to line) image4 image5 image6 and not: image1 image2 image3 image4 image5 image6. To be more precise i want to add a condition that when the loop reaches 3 values, it returns to a new line and continue printing the results.

Advertisement

Answer

Try this. not tested but should work as your need.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement