The myth of while? How can I make a "only once" object appear only once? Without being affected by other while?

clipboard.png

my question is a bit complicated
the orange line is a while
color line is also a while
film, you can see that it has been duplicated (I use distinct, you can see that there is a problem)

on the right side of the shopping list is to show the name of the store
and then all the goods in the store
, so I have to print each store name
and then print each corresponding store

.

I"m completely stuck here now.
my goal is to print as many items as there are in the line
, but only one object in the color box will be fine!
if there is only one item (offline), then everything will be normal.
but if there are more than one item on the offline line, he will reorder more than one item. There are several identical
I would like to explain how to solve it?
how to write if it is a general way of thinking?

Mar.31,2021

so there is a problem with the sql statement of the query. You should divide it into two queries: one query the data of the outermost while, and one query the while data of the blue picture
query the outermost data is a List, and then store the List information of the picture in a field
-- do not understand PHP, but have the same meaning

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3059c-2bcfb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3059c-2bcfb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?