On average, I Have been doing quite well on my "TAXA" Wood Wood Knowledge Base website in getting many of the features coded and working --- more than this slow
and amateur PHP coder that he could. I even got a search engine working yesterday,
something I was not sure that I could do. Arranging travel up the botanical tree
is one of the major tasks yet to be conquered in the whole plan for the site.
To help anyone to visualize what this is all like, I will include the URL for the site: http://www.prowebcanada/taxa
There are 4 entry points to the tree. If you have had any botanical training ever, you will recognize what these are (all to do with botanical taxons). There are 4 levels connected by three one-to-many relationships:
Order -----> Families
Family ----> Genera
Genus -----> Species
(i.e. - A hierarchical tree)
Once you enter into this botanical tree at any of these levels, traveling down the tree all the way to details on one wood (one species) works well (amen!).
Now I want to complete being able to go the other direction UP the tree. This means for any species, genus or family, finding the parent of that element. I suspect that this should be a fairly standard solution requiring a join between the present table and the parent table. I keep getting error including fatal errors whenever I try to craft the right SQL statement that will do this. My apologies for being so inept at this.
If I can get help just creating ONE of the three solutions, I am sure that I can get the remaining two to work. Lets choose going from a page that is displaying a family to be able to find its parent order. Here are some basic facts to guide you:
The database is called 'taxa"
The PHP file that displays each family
(our upward start point) is 'showfamilies.php'
Family data is stored in "sci_family"
Family names are stored in column "family_name".
We need to find what order is the parent for any one family being displayed.
The local key to equate from is column 'orderID'
The orders are displayed in file 'showorder.php'
but order data is stored in table 'sci_order'
This file also has a prime key (foreign key) of 'orderID"
Once I can have code to find the parent, there are two things I will want to do
with it. First, I simply will display the order parent on the family page. Secondly, I should have little trouble or none, crafting a link to travel UP the
tree to take the user to the display page for that parent order.
Later, after replicating the algorithm to the other two remaining relationships it should not be long before total travel up and down the tree will finally be complete. I have tried working on the required SQL statement but always come up
with errors. That is especially the help I need. Being able to travel both directions is one of the key functions planned for this knowledge tree.
I trust I have included the parameters and names you will need. I could provide the entire schema for both MySQL files ... but that really should not be needed and could even cloud and complicate thinking. I look forward to help from the group with thanks even in advance.
... Eagerly waiting for code suggestions,
Bill Mudry
Mississauga, Ontario Canada
(billmudry at rogers.com should you care to email me).