hello sir, one could use bit fields for that. you can store the value of what has been checked on your form in one charater, or 1 integer, or 1 bytes thats 256 different values for you. also if you want to do it more transparently you can use at least 12 char/bytes and just bit flip what you want to know was checked. that will enable you to save your results easy and light to you db. this idea just came out the moment i have read this. mho hth, kray
Muharem Lubovac <[EMAIL PROTECTED]> wrote: Here's some reading. http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html http://www.devshed.com/c/a/MySQL/An-Introduction-to-Database-Normalization/ By normalizing database you'll end up with more tables but that doesn't mean that you'll have 2 or more tables with exact same structure. What are 90 checkboxes for? wrwatson2003 <[EMAIL PROTECTED]> wrote: In reality, there are 90 checkboxes in my form that have the possibility of getting "checked" by users. To make my previous inquiry more easy to work with, I used only 12 checkboxes and 4 tables. All I have right now to work with as far as a concept is this: I have 90 checkboxes in one HTML form that users will fill out and submit the information to my database. This means that I have 90 possible values that I will need to store in my database. It is possible that all 90 of these checkboxes (values) could be selected (per user session) at least a total of 10,000 times. I need to know of a good way to do this. I want to be able to handle these values efficiently and store the 90 checkbox values in my database without making my database run very slow when I build the queries to extract (display) records. I do know for a fact that there will be over 10,000 records put into the database immediately once the project is finished. I don't think having 900,000 fields to filter through in one table is a good idea! I was told by an MCSD that the more tables I have, the better. I'm not really sure why I thought I would need 4 tables. I'm looking for a way to minimize the number of fields my queries have to search to retrieve data. I think maybe I took a previous concept and merged it with the idea of storing checkbox values in variables. Who knows? Can you help me? What do you suggest I do? Thanks in advance! William --- In [email protected], Muharem Lubovac <[EMAIL PROTECTED]> wrote: > > Why do you need 4 tables with exact same structure? That doesn't make any sense? > > wrwatson2003 <[EMAIL PROTECTED]> wrote: In reality, my project is really a huge one. I am giving a very > shortened version of what I need to accomplish so that hopefully > somebody can make sense of the basic functionality I'm looking for. > Thanks in advance for any help provided! > > 1.) Let's say that I have 4 tables (table1, table2, table3, table4). > All 4 tables share the same exact structure: > > For Example, > > table1 > ============== > prod_id (PRIMARY KEY, AUTO_INCREMENT) > prod_1 > prod_date (DATE STAMP) > ============== > > 2.) I have an HTML Web page called collectdata.html. On this same > Web page, there is a form where I am using checkboxes to collect > information to insert into the 4 tables (mentioned above) in a mysql > database. The opening form tag is formatted as shown here: > > <form action="insertdata.php" method="POST"> > > NOTE: Therefore, when the form on collectdata.html is submitted, the > values of the checkboxes that have been "checked" will be passed > through the PHP page, insertdata.php. This PHP page will receive, > POST, and process the form checkbox values, then store the values in > the database. > > 3.) There are a total of 12 checkboxes in the form which are split > into 4 groups. There shall be 3 checkboxes per group with 3 separate > checkbox values per group. Each group of checkbox values shall be > stored in 4 separate variables. Each separate group of checkbox > values shall be inserted into its assigned table. > > GROUP FIGURE 1-1 > > Group 1 checkbox values: > (Widget 1, Widget 2, Widget 3 = $prod_1) will be stored in table1 > ------------------------------------------------------------------- -- > Group 2 checkbox values: > (Widget 4, Widget 5, Widget 6 = $prod_2) will be stored in table2 > ------------------------------------------------------------------- -- > Group 3 checkbox values: > (Widget 7, Widget 8, Widget 9 = $prod_3) will be stored in table3 > ------------------------------------------------------------------- -- > Group 4 checkbox values: > (Widget 10, Widget 11, Widget 12 = $prod_4) will be stored in table4 > > > 4.) The checkboxes and their values are grouped as show below using > the format that tells the database that I want to store each > separate group of checkboxes into a variable (e.g. Group 1 will be > stored in a variable called $prod_1, etc.). Keep in mind that each > group of checkboxes has 3 different products (values) that I want to > store in each variable (as shown in GROUP FIGURE 1-1 above and in > GROUP FIGURE 1-2 below). > > Here are the groups of checkboxes: > > ------------------------------------------------------------------- -- > > GROUP FIGURE 1-2 > > [Group 1 Checkboxes] > > These 3 checkbox values are to be stored in a variable ($prod_1) > using an array and inserted into the database table (table1) and > into the table1 field (prod_1): > > <input type="checkbox" name="prod_1[]" value="Widget 1"> > <input type="checkbox" name="prod_1[]" value="Widget 2"> > <input type="checkbox" name="prod_1[]" value="Widget 3"> > > Once the checkbox values are stored in a variable and inserted into > the database (table1, prod_1), I should be able to look at the > record in the database and see that prod_1 contains the values > Widget 1, Widget 2, Widget 3. > > ------------------------------------------------------------------- -- > > [Group 2 Checkboxes] > > These 3 checkbox values are to be stored in a variable ($prod_2) > using an array and inserted into the database table (table2) and > into the table2 field (prod_2): > > <input type="checkbox" name="prod_2[]" value="Widget 4"> > <input type="checkbox" name="prod_2[]" value="Widget 5"> > <input type="checkbox" name="prod_2[]" value="Widget 6"> > > Once the checkbox values are stored in a variable and inserted into > the database (table2, prod_2), I should be able to look at the > record in the database and see that prod_2 contains the values > Widget 4, Widget 5, Widget 6. > > ------------------------------------------------------------------- -- > > [Group 3 Checkboxes] > > These 3 checkbox values are to be stored in a variable ($prod_3) and > inserted into the database table (table3) and into the table3 field > (prod_3): > > <input type="checkbox" name="prod_3[]" value="Widget 7"> > <input type="checkbox" name="prod_3[]" value="Widget 8"> > <input type="checkbox" name="prod_3[]" value="Widget 9"> > > Once the checkbox values are stored in a variable and inserted into > the database (table3, prod_3), I should be able to look at the > record in the database and see that prod_3 contains the values > Widget 7, Widget 8, Widget 9. > > ------------------------------------------------------------------- -- > > [Group 4 Checkboxes] > > These 3 checkbox values are to be stored in a variable ($prod_4) and > inserted into the database table (table4) and into the table4 field > (prod_4): > > <input type="checkbox" name="prod_4[]" value="Widget 10"> > <input type="checkbox" name="prod_4[]" value="Widget 11"> > <input type="checkbox" name="prod_4[]" value="Widget 12"> > > Once the checkbox values are stored in a variable and inserted into > the database (table4, prod_4), I should be able to look at the > record in the database and see that prod_4 contains the values > Widget 10, Widget 11, Widget 12. > > ------------------------------------------------------------------- -- > > 5.) Once all the checkbox values are inserted into the database, I > want to be able to select (query) the data from all 4 tables > simultaneously and group the SELECT FROM query results so that I can > display the results in an HTML table on a Web page called > results.php. The results displaying in the HTML table should be > split into 4 columns where the number of table rows depends on the > total number of records found. > > Are there any takers on this one? I haven't the slightest clue how > to pull this one off. I have read tutorials and tried to do > this "monster of a project" from what little information has been > given. I did see where most of the tutorials contained iformation > about using ".implode". The examples were not that good, so of > course I got lost in a hurry. I have put several hours into testing > methods and trying to find the answer with no success thus far. My > job is on the line and my deadline for this project is running out! > > Any help on this matter is greatly appreciated! > > Thanks! > > > > > > > > The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. > > > > SPONSORED LINKS > American general life and accident insurance company American general life insurance company American general life American general mortgage American general life insurance Computer internet security > > --------------------------------- > YAHOO! GROUPS LINKS > > > Visit your group "php_mysql" on the web. > > To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. > > > --------------------------------- > > > > > > > ~moe > > --------------------------------- > Yahoo! Shopping > Find Great Deals on Holiday Gifts at Yahoo! Shopping > > [Non-text portions of this message have been removed] > The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. SPONSORED LINKS American general life and accident insurance company American general life insurance company American general life American general mortgage American general life insurance Computer internet security --------------------------------- YAHOO! GROUPS LINKS Visit your group "php_mysql" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- ~moe --------------------------------- Yahoo! Shopping Find Great Deals on Holiday Gifts at Yahoo! Shopping [Non-text portions of this message have been removed] The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. SPONSORED LINKS American general life and accident insurance company American general life insurance company American general life American general mortgage American general life insurance Computer internet security --------------------------------- YAHOO! GROUPS LINKS Visit your group "php_mysql" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- __ _ ____ | |(_) / || | __ _ ,_ _______ | -- | || |> \/'\/ || __ | \ \ | || || +-+-+ || ___/ /+__\ \| || || | | | | \ \ < > copyryt 2003 (r) --------------------------------- Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates. [Non-text portions of this message have been removed] The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php_mysql/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
