NYCPHP Meetup

NYPHP.org

[nycphp-talk] State table implementation ideas

Leila Lappin damovand at yahoo.com
Sat Feb 4 11:44:12 EST 2006


Hi Cliff,

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
following:

Table one:
     Field A   Field B ... Field N   Options_Group_ID
Table two:
     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.

Leila

--- 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
> solution?
>  
> Cliff
> > _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> New York PHP Conference and Expo 2006
> http://www.nyphpcon.com
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the talk mailing list