michael1291 wrote:I orrigionaly planned on saving the areas they select in one field as they would only select a few areas at a time but struggled to retrieve the checkbox value to select the checkbox they are operating in.
That sounds like you're wanting to create a multi-valued field. If so, don't (and erase that notion from your thoughts permanently :p). The first normal form states that you have no multi-valued fields (or "columns" or "attributes" or whatever you want to call them).
michael1291 wrote:Do you think it is s bad ideanto have this many columns ?
I think it is a bad database design, yes. All of the following statements hold true, and none of them belong in a proper DB schema:
Modifying existing areas means you would have to modify the actual table schema.
Adding new areas means you would have to modify the actual table schema.
Deleting old areas means you would have to modify the actual table schema.
Your SQL queries will probably be very large simply because you've spread out related data across a large number of columns (e.g. all of the columns are describing the same thing or idea... just specifying a different value).
michael1291 wrote:Will it affect performance ?
I would say yes, it will.
If user1 operates in 2 areas, the corresponding row in your DB will still contain null/empty/etc. values for the other ~117 areas.
Personally, I would create a separate reference table that maps the many-to-many relationship between users and areas. It would have only two columns - (user_id, area_id).
Going back to user1 (where userN describes a user with an ID of N), and assuming the two areas he was working in had IDs of 1 and 2, you'd see two tuples in the reference table: (1, 1) and (1, 2).
In other words, a user would have one row per area worked in. It's a lot more efficient/compact, and, in my opinion, it's a heck of a lot easier to work with SQL queries dealing with only 2 columns than ones dealing with ~119 columns.
Plus, modifying/deleting/adding new areas does not require any schema modifications - just regular UPDATE/DELETE/INSERT queries.
michael1291 wrote:Would you know how to retrieve the value from a single field to then check a check box
That would largely depend upon: a) how the data is stored in the DB, and b) how the data in the DB is related to the checkbox(es).
michael1921 wrote:I had it working up to a point where it would check it if a any value existed but because the value was entered by array and separated by a comma
In other words, you had a multi-valued field? See my first response above. 😉