>From everything I've picked up and learned over the years I've been
developing, the sort of solution you're suggesting is a definite OMG
what the hell are you doing? situation.

If you're having to deal with items that may have different
information specified, why not do something a little different...

Events---->Event_Fields

In other words, you have an Events table that holds ID numbers and any
information that DOES get captured for every single event, and an
EventFields table which stores additional information, one item per
field. The rough schema would be something like this...

Events
---------
id
name
start_date
end_date

EventFields
------------------
id
event_id
field_name
field_value

You could even set it up so you had another model containing available
fields which would specify the types of information you were wanting
to capture (just so you can control it a little bit - you could use
this model to populate a select box, for example). Then you'd tie that
in and add field_id to EventFields in place of field_name, or as well
as.

Please note that I've not actually developed the code behind this
idea, it should work though. I'd be interested to know what other
people think... I'm certain it's a better solution than dynamically
creating tables and models, but HOW much better?

On May 31, 10:17 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> That would be an awful lot of tables in your database and it seems
> like it might lead to some potentially hairy code.  Have you
> considered saving the event information as arrays and then saving the
> serialized arrays into a single table?  I would think it would be a
> lot easier to extract varying properties from out of arrays then
> tables with different numbers of fields.
>
> On May 31, 1:05 pm, Wole <[EMAIL PROTECTED]> wrote:
>
> > I am developing an events registration Web application that collects
> > event specific information from registrants and stores the information
> > in a database table. The application works by assigning an id to each
> > new event then using this id as the name of the table that will hold
> > registrants' information.
>
> > The problem comes when I need to access the data for an event. I
> > cannot setup a model file ahead of time because the tables are created
> > dynamically . Also, I cannot combine all event data into one table
> > because the information collected from each event varies and hence so
> > will the number of columns and column data types in each table.
>
> > Is there a way to dynamically create a model and bind a table to that
> > model? In other words, is there a way for me to switch between tables
> > using a single model? Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to