dazzathedrummer Posted May 7, 2010 Share Posted May 7, 2010 Hi, I'm writing a simple checklist for monitoring workflow. It will be a form, a list of tasks with radio buttons that return '0' or '1'. I'm planning to store the results in a MySql db, i'm just wondering what the best way to do this is. My initial thoughts are to store the results as a string in one field in the db (like '11100100010' etc) and then split that out to feed the form using LEFT in the query (LEFT(Field, 3) as 'Job 3' or something like that). If that is a sensible way to do it - how do I go about creating the string from the 'submit', i mean, i understand how to update the DB, thats fine - I'm just not to sure how to create a string from several form elements?? Quote Link to comment https://forums.phpfreaks.com/topic/200988-simple-checklist-form-question/ Share on other sites More sharing options...
siric Posted May 7, 2010 Share Posted May 7, 2010 The question of using one or many fields depends on the number of inputs you have. Also remember that if you use one field, then for every query against the database you have to run some extra processing to get the result extracted. Personally, i would use separate fields for each one. To create a string from submit, you assign the posted variables to a variable in your action script $var1 = $_POST['var1']; $var1 = $_POST['var1']; and to string them together, if you want to use 1 table field $string = $var1.$var2.... Quote Link to comment https://forums.phpfreaks.com/topic/200988-simple-checklist-form-question/#findComment-1054504 Share on other sites More sharing options...
dazzathedrummer Posted May 7, 2010 Author Share Posted May 7, 2010 ah ok, so its more efficient to have a database with sat 100 fields, each containing 1 or 0 than to have one field with a string of 100 chars. Ok, in that case its I dont need to concatenate the form results. Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/200988-simple-checklist-form-question/#findComment-1054519 Share on other sites More sharing options...
siric Posted May 7, 2010 Share Posted May 7, 2010 ah ok, so its more efficient to have a database with sat 100 fields, each containing 1 or 0 than to have one field with a string of 100 chars. Ok, in that case its I dont need to concatenate the form results. Thanks!! Remember, I said that it depends on how many fields you have. You can try either way to see if it makes a difference in performance. Simply, you 2 choices for a select are With 1 field - Select field from table. - run string function to locate and extract one of multiples values With multiple fields - Select fields from table Quote Link to comment https://forums.phpfreaks.com/topic/200988-simple-checklist-form-question/#findComment-1054573 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.