>One field in the database is input by checking multiple check boxes.
>When the insert member record is submitted and multiple check boxes
>are selected, the information becomes an array of text separated by commas.
This is poor database design. Although it's possible to use php and MySQL functions to deal with this, it is still a bad way to store data. Why not just use a seperate database field for each option - or - create another table to store the option values?
Thanks for getting back with me. I do have two tables. One table is the "members" table where all the information for the members is stored. One of the columns is "currentClubPositions". The database has another table which is "positions" which has the list for the positions that a member of the club could serve on. Members of the club may be serving on a number of positions at once, therefore the check boxes. Also, the club is adding and deleting positions over time, so I wanted an easy way to add them and delete them without having to go into phpmyadmin to do this. I have created a form that updates the "positions" table. The check boxes that show up in the insert member record and update member record are dynamic so that when the table "positions" changes, the forms change dynamically as do the queries to sort the database change dynamicaly. When the check boxes are entered, I use the implode function to make the values an array of text separated by commas and that value is inserted in one field of the members table named "currentClubPosition". I am all ears to hear a better way. Take a look at the web pages (see the original post) that I have created and you will see how all this ties together. Thanks, Wayne Rowlands
1 person found this helpful
A better database design would be to insert a row in the position table for each position assigned to a member. So if 'Joe' holds 5 positions, he would have 5 rows in the table.
Of course it's possible to do what you want with your existing design, but I don't do PHP so I can't really help much with the code. You're also better off asking these questions in the app dev forum, and be prepared to provide the php code for the form pages.