King0r12 Posted March 10, 2015 Share Posted March 10, 2015 I've been messing around making a site which had a lot of drop downs etc which I want results into a database. Just don't know which way would be best so heres an example. A man goes out fishing and catches 15 fish . 2 fisha, 2 fishb, 3 fishc, 1 fishc and so on... So I need a way to enter this so (name drop down , quantity textbox, weight average textbox, length average text box and more info text box). Bit confused how I can do this unless having loads of input boxes etc on a page then fill them out and submit to a db or is there an easier way maybe to an array.. (But then how would it look and would that be the easiest way of processing it all?? I've already tried several ways. The biggest thing is how the db table would look like. Because there's only say 30 different FISH names hence the DROPDOWN so would it make sense to have several cols for each fish so: ID - FISHA - FISHA_weight - FISHA_length..... 01 - yes. - 20kg. - 40cm.... Or something like ID FISH - WEIGHT - LENGTH 01 - FISHA,fishb,fishc - 2kg,39kg,32kg - 39cm,45cm,78cm.... Been messing around trying different things just want some advice and a steer in the right direction as there's probably a simple solution which I haven't thought of. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/295203-which-way-to-go/ Share on other sites More sharing options...
jcbones Posted March 14, 2015 Share Posted March 14, 2015 You would normalize the data to at least the 3rd form. That means you would have a: Users table, this holds all data relative to the user. Name, Address, Password, Group, etc. Fish table, this holds all data relative to a type of fish. Type, Description, WaterType, Schooling, etc. Catch table, this would hold each individual catch, tying back to the userID, and the fishID. userID, fishID, weight, length, etc. You could go further, and have a table with all the local, or territorial waters, then tie the fish back to it.Bottom line is that databases are not spreadsheets. Each individual entry gets its own line, there should be little to no repeated data. Quote Link to comment https://forums.phpfreaks.com/topic/295203-which-way-to-go/#findComment-1508033 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.