Thanks for the reply and I apologise for my first explanation, I was struggling to document it clearly.

Your example does work and echos out the $reqno against the appropriate item no if I change echo $item, to echo $reqno; but that's my problem.

I only want it to echo the $reqno once per 3 items displayed. If all 3 items are rejected I want it to echo the $reqno once and at item 1. If item 1 was pending I need it to display item 2 and item 3 with the $reqno being displayed at item 2 only and item 3 blank.

Initially when a req is raised it can have 1 item, 2 or 3. When I insert it I create a row for each item in the db with the same req number. It looks like: