Hi,
you can't directly, because the html draw from top to bottom.
You can do something using a temporary array of N position, where N is the num of pic per line. (It's not easy to tell...)
You can look in db for N row, memorize the string to echo in 3 array of N position, then echo it on screen. And repeat all for each row in db.
...hmm ... this helps? 😃
If you don't understand me, ask more, I'll try to do an example...