Hi,

we have a database where users sign up to one program of several
(eg. in the user table there is a field prog_id referencing the
auto_increment key of the program table)

The program table holds a multitude of information (text, varchar, decimal,
int, date fields)

For some users they need a customised program - where one (or possibly a
few) of the fields in program need to be uniq for that user. But by far
the majority of users use a generic program

What is the best way of handling this?

Up to now we have been creating a separate entry for each of these users in 
a table called custom_program (the same field structure as program) and
populating this. However it gets difficult to maintain.

We have thought of just putting the changed fields into custom_program but
this complicates selects (eg. if the non changed fields are NULL we need to
select * from custom_program where user=x
and then loop through each field and if it is not null we modify the value
we've previously taken from program.

The other idea I had was to create a table
CREATE TABLE overrides (
  user varchar(10) NOT NULL,
  field_name varchar(30),
  field_value varchar(30)
) TYPE=MyISAM PACK_KEYS=1;

and then 
select field_name, field_value from overrides where user=x
and loop through each over-ride. This seems a bit of a cludge because the
different fields are really different types (text, varchar, decimal, 
int, date fields). 

Anyone got a clever way of dealing with this?

/Dave


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to