In my database I have two tables one politics (politics_id, politics, politics_type_id) and other tipo_politics (politics_type_id, politics_type).
This is the table
It looks like you want the headers to be displayed only when there's a change in politics_type. This would require keeping a track of its value in every iteration and the logic can thus be constructed as follows:
-
The layout of the $previous_politics_type variable.