Print Data From Recordset Before Repeat Region

Using mySQL/PHP, I have a recordset set up with a repeat region that displays all of the records in a database, and have set ‘ORDER BY’ to a field called ‘showroom.’ There are 5 different showrooms and hundreds of records that each contain one of the five.

My query is ordering the recordset by ‘showroom.’, but when it displays on the page it’s just a giant list with no separation between showrooms. I would like some PHP code that will print the showroom name when the records go from containing one showroom to another.

For example:

HOW IT LOOKS NOW (BAD):
Record 1
Record 2
Record 3
Record 4
Record 5
Record 6
Record 7
Record 8

HOW I NEED IT TO DISPLAY (GOOD):

ATLANTA SHOWROOM
Record 1
Record 2
Record 3

DALLAS SHOWROOM
Record 4
Record 5
Record 6

DENVER SHOWROOM
Record 7
Record 8
Record 9

Leave a Reply

Your email address will not be published. Required fields are marked *