Re: Seating chart registration system?

From: Date: Sat, 21 Jun 2003 06:14:12 +0000
Subject: Re: Seating chart registration system?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-152365@lists.php.net to get a copy of this message
On 21-Jun-2003 Jay Fitzgerald wrote: > I am writing a php event registration system for lanparties and I believe > I have everything written that I need except for a seating selection > chart. <snip> > As a person goes through the event registration system, they will come to > a > page that displays 8 rows of 30 seats (240 seats total)...but in the > future > I would like to have admin capability to increase or decrease this > amount. <snip> > Then when the next person decides to register, when they get to that > page, one less seat will be available. I would like to have as much > control as possible and I do know a minor bit of php and mysql. > > Any help or guidance is appreciated. > <programmer doodle> Couple of thoughts ... Each 'event' is unique to time and place. So you'll need a 'event' table with datetime, interval, name, description and a place (or 'forum' --see next paragraph). table event ( id int unsigned auto_inc primary key, idforum int unsigned, ebeg datetime not null, // begins eend datetime not null default '0', // ends emin int unsignd default 0, // how long in minutes name varchar(64), descript text, index idx_b (ebeg), // might be handy ... index idx_f (idforum) ) Each place is (usually) limited to hosting one 'event' at any interval. But some places can have several events at the same time. Consider a major hotel and all the conference rooms --or a sports stadium with all the owner, boxholder's, home-team, & visting-team parties ... So 'place' is a poor term. I'll suggest using 'forum' as the locale to be to attend a particular event. Also you'll have to think about assigned seating and/or general admission seating. Example: At the downtown Hilton, the local Lions club might reserve the "Omega" room w/ 5 seats per 4 tables, general admission. But a dinner with President Bush in the "Omega" room is gonna run like 6 seats @ 40 tables. And definitely assigned seating. Same room name but clearly a different 'forum'. It's a toss-up if this should be a field in the 'event' or in the 'forum' table. I go with forum. So there's another table: table forum ( id int unsigned auto_inc primary, name varchar(16), descript text, ftype enum('A', 'G'), // assigned or general seating m_block int unsigned not null, // max # of seating blocks m_seats int unsigned not null, // seats per block block_type enum('row','table','section') not null default 'row', // what does m_block encompass? seat_limit int unsigned not null default 0, // maximum seats (m_block * m_seats where ftype='A') unique index (name) ) Then there is seating. When each event/forum is scheduled your app adds m_block * m_seats to a seating table. For general admission add block=x, seat=1 -> seat_limit. --- The 'seating' table is where it gets tricky --and where it gets solved. table seating ( idforum int unsigned not null, // link to forum description. block int unsigned not null, // a dinner table or stadium row seat int unsigned not null, // d'oh guest int unsigned not null default 0, // who has this seat ? primary key (idforum, block, seat), INDEX idx_g (guest) // handy stuff. ) Assigned seating: As each guest reserves a [optional] seat: "UPDATE seating SET guest='$idguest' WHERE idforum='$idforum' AND block='$idblock' [AND seat='$idseat'] AND guest=0" General admission: "UPDATE seating SET guest='$idguest' WHERE idforum='$idforum' AND block='$idblock' AND guest=0" </programmer doodle> Regards, -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#152365) next »