borzoid
10-06-2005, 01:16 AM
Greetings,
I've worked with software that uses php for sometime now and in editing it and rearranging things I've become fairly comfortable about the principles behind a lot of the coding.
Now I want to write some functions of my own. I've been reading tutorials until I'm blue in the face and the simple functions shown in the tutorials were pretty understandable. But then I tried to go on and learn the code to do what I want and have been totally overwhelmed with the tons of stuff I've read - most of which didn't make sense to me.
So hopefully someone here can tell me if what I want to achieve is possible and give me a bit of a start so I can break this mental block about learning php.
I have 3 tables
table: Animals
fields: animal_id, titles_prefix, name, titles_suffix, DOB, breeders, sire_id, dam_id
table: Sires
fields: sire_id, animal_id //the animal_id is that of the parent not the child
table: Dams
fields: dam_id, animal_id //the animal_id is that of the parent not the child
What I want to do is for the selected animal from table: Animals echo the animals information on two lines (concatenating the name and two titles fields) and then setting the sire_id and dam_id as variables to be used in the next instance of the function.
The next instance of the function would use that variable to find the animal_id for the sire or dam and print their information and set their sire_ids and dam_ids as new variables. As I understand it each instance of the function would need to use a different variable name to all work on the same page (sire, gsireS, gsireD, dam, gdamS, gdamD, etc...) - as you can guess I'm trying to write a simple pedigree. I don't need to be able to search backwords from parent to child, just display each successive generation.
Does this make sense and is it possible.
Thank you in advance. I would be greatful for any push in the right direction so I can say "doh....that's how that works"
connie
I've worked with software that uses php for sometime now and in editing it and rearranging things I've become fairly comfortable about the principles behind a lot of the coding.
Now I want to write some functions of my own. I've been reading tutorials until I'm blue in the face and the simple functions shown in the tutorials were pretty understandable. But then I tried to go on and learn the code to do what I want and have been totally overwhelmed with the tons of stuff I've read - most of which didn't make sense to me.
So hopefully someone here can tell me if what I want to achieve is possible and give me a bit of a start so I can break this mental block about learning php.
I have 3 tables
table: Animals
fields: animal_id, titles_prefix, name, titles_suffix, DOB, breeders, sire_id, dam_id
table: Sires
fields: sire_id, animal_id //the animal_id is that of the parent not the child
table: Dams
fields: dam_id, animal_id //the animal_id is that of the parent not the child
What I want to do is for the selected animal from table: Animals echo the animals information on two lines (concatenating the name and two titles fields) and then setting the sire_id and dam_id as variables to be used in the next instance of the function.
The next instance of the function would use that variable to find the animal_id for the sire or dam and print their information and set their sire_ids and dam_ids as new variables. As I understand it each instance of the function would need to use a different variable name to all work on the same page (sire, gsireS, gsireD, dam, gdamS, gdamD, etc...) - as you can guess I'm trying to write a simple pedigree. I don't need to be able to search backwords from parent to child, just display each successive generation.
Does this make sense and is it possible.
Thank you in advance. I would be greatful for any push in the right direction so I can say "doh....that's how that works"
connie