All,
I tried to figure out how to choose 15 tickets in one block of seats.
EDIT : the problem is how to find all the rectangles of the given sizes (for example, 3x5) free spaces?

My table is below, and the query selects 4 consecutive seats (or 15 or something else), which is fine ...
But what I want to do is select 15 places, they can be divided into several lines, i.e. 3 x 5, but I would like them to be locked together.
row 9 ..(some seats)..[5 seats]..(some seats).. row 8 ..(some seats)..[5 seats]..(some seats).. row 7 ..(some seats)..[5 seats]..(some seats)..
those. they would be 3 rows in front of each other. row of 9 places from 10 to 25, row of 8 places from 10 to 25, row of 7 places from 10 to 25.
It may also be necessary to consider whether the seat block has a different number of seats, i.e. the corner block may have an arc to have more seats in the back than in the front.
Any manual in the form of ehnaceing SQL or some algorithm or some PHP code. I waved my brain for most of the week.
CREATE TABLE `seats` ( `id` int(11) NOT NULL AUTO_INCREMENT, `event_id` int(11) DEFAULT NULL, `performance` int(11) DEFAULT NULL, `block` int(11) DEFAULT NULL, `row` int(11) DEFAULT NULL, `seat` int(11) DEFAULT NULL, `status` int(10) DEFAULT 1, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
My date request is one that returns combinations of blocks from X places.
SELECT a.event_id, a.performance, a.block, a.row, a.seat AS start_seat, a.seat + (4 - 1) AS end_seat, 4 AS requested_seats, a.id AS start_allocation_id FROM seats a LEFT JOIN seats b ON a.event_id = b.event_id AND a.performance = b.performance AND a.block = b.block AND a.row = b.row AND a.seat < b.seat AND b.seat < a.seat + 4 AND b.status = 1 WHERE a.status = 1 AND a.event_id = 1 GROUP BY a.seat HAVING COUNT(b.seat) + 1 = 4 ORDER BY performance
Thank you in advance, you need more information, please just ask!