Jump to content
Larry Ullman's Book Forums

Recommended Posts

The objective is to have the user provide some characteristics via a form. Based on the user’s input the php program would output a resorted table placing the nearest match on the top, with the second closest match on the second row and so on. 

 
I believe the table is small enough to store in an array?
Some of the cells/fields can hold multiple values. Should these be stored as an array within an array?
 
 
The full table has 40 rows.
 
Thank you for your suggestions and advice.
 
 

 

Link to comment
Share on other sites

The table rows represent an animal species. The cells within a row represent traits of that species.  

 

User data is compared against the corresponding data in row cell of the table (http://virginianaturalhistorysociety.com/temp/table.png)

When user data matches the corresponding cell in a row a 1 is returned, else a 0. Table rows are then sorted by highest score (most matches) and displayed to the user.

 

For example:

 

The user data = Sandhills, Slender, Smooth, Uniform, Brown, White

 

The user data is  compared against the corresponding data in each row cell of the table (http://virginianaturalhistorysociety.com/temp/table.png)

 

Species (row) one has 3 matches

Species (row) two has 4 matches

Species (row) three has 6 matches

Species (row) four has 3 matches

 

Rows would be sorted by the number of matches:

 

1. Species (row) three has 6 matches

2. Species (row) two has 4 matches

3. Species (row) one has 3 matches

4. Species (row) four has 3 matches

Link to comment
Share on other sites

  • 4 weeks later...

Okay, this is going to be a bit tricky to do, and you'll want to start small and work your way up. First, I would definitely normalize the database structure. Although you could store multiple values in arrays, that'll make it much harder and slower to search. I would also highly recommend that you create checkboxes or drop-down menus for the user to select qualities. That will limit room for error. With all that in mind, I'd then start with the functionality to check maybe 2 things and work your way up. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
 Share

×
×
  • Create New...