PHP MYSQL loops to output a single piece of data sequentially

I want to do a circular sequence to output pictures. Don"t know how to write this code?

Table structure

005B0nMbgy1fpse0r1t22j30ll0h3jt3.jpg

for example, now the field ID of key=1 is 1, 2, 5, 7, 10, 11, 6 fields

I want to output one at a time in order.

output id 1 field for the first time

output id 2 field for the second time

.

output id 11 field for the 6th time

output id 1 field for the 7th time

output id 2 field for the 8th time

.

output the next field of id for the Nth time

cycle forever.

No matter how many key=1 are inserted in the middle, the data will be looped.

how to write this PHP, please.

currently found a sequential output sql, but it is not convenient to use

select * from tu_pic order by field (id,9,5,6,7,8) limit 1

Feb.27,2021
Make a decision in the

loop. If it is greater than 6, let the loop's key initialize

.
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-1b2c2f7-2bae6.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-1b2c2f7-2bae6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?