[nycphp-talk] State table implementation ideas
damovand at yahoo.com
Sat Feb 4 11:44:12 EST 2006
You basically have a right idea, except that you may
want to split the information into two tables. Place
the options in a separate table where each group of
options can be cross-referenced with the information
in another table with a unique ID, something like the
Field A Field B ... Field N Options_Group_ID
Options_Group_ID Option_ID option
As you may not this design will allow you to create
multiple options, in table two, pertaining to the same
row in table one.
--- Cliff Hirsch <cliff at pinestream.com> wrote:
> I need to generate an "options list" that is based
> on several status
> fields. Sort of like, "if you can rub your belly,
> scratch your head and
> stand on one foot, you can proceed past the
> breathalyzer test, join the
> circus or run for governor of Massachusetts.
> What started as a simple if statement has grown into
> multiple switch
> statements with some if statements thrown in just to
> make things
> completely confusing. While this "compresses" a
> state diagram, its
> getting unwieldy.
> So now I'm thinking of throwing the whole thing into
> a lookup table.
> Field A Field B ... Field N Options
> While this will result in a large array and many
> duplicate rows (since
> many of the possibilities are actually the same), it
> should be really
> easy to maintain and a great visual aid for those
> unlucky souls that
> inherit my code.
> Any other ideas? Or is a lookup table the best
> > _______________________________________________
> New York PHP Community Talk Mailing List
> New York PHP Conference and Expo 2006
> Show Your Participation in New York PHP
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the talk