Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/295203-which-way-to-go/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/295203-which-way-to-go/#findComment-1508033
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.