Dog Pedigree |
7/16/2007 3:49:40 PM |
PHPRunner General questions | |
author
Greetings: |
|
J
|
Jane 7/17/2007 |
Mary, |
|
501288 7/18/2007 |
Hi Jane: just wanted you to know that I am trying to upload to demo but having problems. I hope it will be there soon. Thanks so much! |
|
501289 7/19/2007 |
Mary, I think you can create table with all grandDads and grandMothers using ViewOnLoad event on the Events tab. Publish your project to the Demo Account, post link to your pages here and I'll try to help you. |
|
501290 7/19/2007 |
Mary, I think you can create table with all grandDads and grandMothers using ViewOnLoad event on the Events tab. Publish your project to the Demo Account, post link to your pages here and I'll try to help you.
|
|
501291 7/23/2007 |
|
|
501292 7/23/2007 |
Hi Jane: I belong to a forum that is run by a gentleman that writes books for php and mysql. This is the recommendation given by one of the other members with a note from the author of books that it is exactly what he would do: >>>>>>>> $sql = "SELECT RegName, SireID, DamID FROM pedigrees WHERE ID=$ID"; $result = mysql_query ($sql); if ($result) { // start an html table echo "<table>"; while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) { $dog = array ('RegName'=>$row['RegName'], 'SireID'=>$row['SireID'], 'DAM'=>$row['DamID']); // get Sire info $SireQ = "SELECT RegName, SireID, DamID FROM pedigrees WHERE ID={$row['SireID']}"; $SireR = mysql_query ($SireQ); if ($SireR) { $SireRow = mysql_fetch_array ($SireR, MYSQL_ASSOC); $dog['Sire'] = $SireRow['RegName']; $dog['GrandSireID'] = $SireRow['SireID']; $dog['GrandDamID'] = $SireRow['DamID']; // add additional queries for greatGrandSire and greatGrandDam } else { $dog['Sire'] = ''; $dog['GrandSireID'] = NULL; $dog['GrandDamID'] = NULL; } // end of $SireR conditional // add additional queries for Dam sIDe of family (no pun intended) // print row of results echo "<tr><td>{$dog['RegName']}<table><tr><td>{$dog['Sire']}</td><td>{$dog['DAM']}</td></tr></table></td></tr>"; } // end of while // close table echo "</table>"; } // end of $result conditionalThis way, all of the dogs can be stored in one table, whether they are parents, grandparents or great-grandparents. Each will have (if you have the information) fields indicating which record in the table is related as a sire or dam. Since you are retrieving the same info whether they are a child, parent, grandparent, etc and only the WHERE clause is different, you could store the SELECT and FROM part of the query as a string, and concatenate the WHERE part at each step, to simplify it. <<<<<<<<<<<<<<<< Would you make it part of the 'view.htm' or the 'view.php' file? Would you use 'Smarty' to generate the arrays? It is my understanding that he is suggesting multidimensional arrays. Thanks!!
|
J
|
Jane 7/24/2007 |
Mary, global $conn; $sql = "SELECT RegName, SireID, DamID FROM pedigrees WHERE ID=".$values["ID"]; $result = db_query($sql,$conn); if ($result) { ... |
|
501293 7/26/2007 |
Mary, I recommend you use this code in the View Page: BeforeDisplay event on the Events tab. All values from the view page are stored on the $values array:
|
|
501294 7/26/2007 |
Jane: thanks so much!! I will give it a try!! Hi Jane: OK I tried it and I am getting this error message: Parse error: parse error, unexpected '=', expecting ')' in /homepages/33/d208885282/htdocs/labradors/labradors/include/Pedigrees_events.php on line 147 This is the section that I believe it pertains to [line 147 on the file called Pedigreeevents.php in the 'include' directory] The second line, which I underlined, is line 147. $dog = array ( 'RegName'= $row['RegName'],_ 'Sire'= $row['Sire'], 'DAM'= $row['DAM']); { // get Sire info I did make one change - I went back from SireID and DamID to Sire and DAM. Could that affect it? http://demo.asprunner.net/brookhill_hughes...adors/login.php Thanks so much for your help!!! |
|
501295 7/27/2007 |
|
J
|
Jane 7/31/2007 |
Mary, |
|
501296 8/1/2007 |
Mary, I can't test your application because there is an error in your event. Publish your project on the Demo Account and send URL to your pages to [email=support@xlinesoft.com]support@xlinesoft.com[/email]. I'll try to help you.
|
D
|
daviesgh 8/2/2007 |
Mary,
|
|
501297 8/2/2007 |
Mary, You may find it easier to change your database structure, and have a dog table and a parent/litter table: Dog Table Fields: ID, RegName, RegNo, RegCountry, Gender, Title, Addl_Titles, Color, Owner, ParentID Parent/Litter Table Fields: ParentID, DamID, SireID, DOB, Breeder DamID and SireID link back the ID in the Dog Table ParentID in the Dog Table link to ParentID in the Parent Table This has the following advantages:
|
J
|
Jane 8/3/2007 |
Mary, |
|
501298 8/5/2007 |
Mary, I think you can use your database structure or change it, but the code in the View page: Before process will be the similar. You need to select all parents for the dog, place these values to the table and print this table on the view page.
|
|
501299 8/5/2007 |
Mary, I think you can use your database structure or change it, but the code in the View page: Before process will be the similar. You need to select all parents for the dog, place these values to the table and print this table on the view page.
|
|
500404 8/13/2007 |
OMY I cannot even believe it but my pedigree works!!! It grabs the correct info and LAYS IT OUT RIGHT - which I must say was no easy task!!! |
J
|
Jane 8/14/2007 |
Mary, //Get Sire( if (is_numeric($row['SireID'])) { $SireQ = $sql . $row['SireID']; $SireR = mysql_query ($SireQ); if ($SireRow = mysql_fetch_array ($SireR, MYSQL_ASSOC)) { $SireRow = array ( 'RegName' => $SireRow['RegName'], 'SireID' => $SireRow['SireID'], 'DamID' => $SireRow['DamID']); } |
|
500405 8/14/2007 |
HURRAY!!! It works!!! I could never had done it without your help! Thanks so much to everyone who helped me get it going!!! |