There should really be another table for all of this information. Say
you're tracking school information for a specific person. That person
would have an ID number and you'd store the school information in a
separate table that stores the user's ID and the school ID. You could
even expand this to track other items by adding a third column that says
the item being tracked is a school, spell, item, etc. This may seem like
a pain now, but it's going to be the most scalable solution. Using
serialize, what happens when someone has all 40 schools and it's over
255 characters? Do you make them all text columns?

An ideal solution would involve a variety of tables. Table 1: Users.
This would store user information such as name, rank, etc, and assign
each one a unique ID. Table 2: Schools. This would list all of the
possible schools that someone can take and assign each one a unique ID.
Table 3: Spells. This would list all of the possible spells and assign
each one a unique ID. Table 4: Call it what you want but this table is
going to link the user IDs to school and magic IDs. If a user
(User_ID=1) has schools abjuration (ID=2) and conjuration (ID=5), then
you'd have two rows in this linking table, 1-2 and 1-5. 

Okay... I've blabbered enough.

---John Holmes...

> -----Original Message-----
> From: Shiloh Madsen [mailto:shiloh_madsen@;]
> Sent: Saturday, October 19, 2002 12:48 AM
> Subject: [PHP] Enum table entry
> Have a question that im trying to figure out how to resolve. I have a
> field type in mysql that is of the enum type. Unless youre familiar
> Dungeons and Dragons, you wont get what the values mean, but hopefully
> youll get the gist anyway. I have a column labelled school which holds
> enum data type comprised of the values 1 through 40. From the website
> front end, where the data is being entered, i want to display, ideally
> series of checkboxes, otherwise a list which would allow a user to
> multiple items in that will translate into this enum field. For
> a series of checkboxes with items such as abjuration, conjuration,
> divination, and others, which will all have a numeric value which gets
> plugged into the enum field. for instance, if a user selected
> and divination, it would be plugged into sql as 1, 3 (or however enum
> is input into its column). That being the case how do i utilize php to
> this to work? what kind of form elements etc... The problem im seeing
> checkboxes are that they are discreet and dont group together, so i
> get all the data to go into one column in mysql. Hopefully i havent
> horribly confused the issue and some kind soul out there can tell me
> to send this data across. As a double nice would you write
> to pull the data back, convert 1, 3 to show abjuration,
> divination? Thanks for the help in advance.

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to