View Single Post
  #8  
Old 08-28-2011, 01:11 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 598,402
Hall of Famer is on a distinguished road
Default

Alright I will show you. But since I am not that familiar with Arianna's family tree script, what I provide below should NOT be directly copy/pasted to your site. It merely serves as a reference, especially since I do not know exactly what your database owned_adoptables looks like and what mysql command you uses to retrieve data.

First of all, you need to retrieve the gender of your parent adoptable. The parentid should be available to you already, and I strongly advise you to name it $parentid to avoid confusion. Write the codes below:

PHP Code:
$result runquery("SELECT * FROM {$prefix}owned_adoptables WHERE aid = '{$parentid}'") ;
$row mysql_fetch_array($result);
$gender $row['gender']; 
Next, you will need to select from database prefix.owned_adoptables for all child adoptables with the very parent. This may vary depends on if the parent adoptable is male or female, as shown below:

PHP Code:
if($gender == "f"){
    
$query "SELECT * FROM {$prefix}owned_adoptables,  
                            
{$prefix}adoptables  WHERE {$prefix}owned_adoptables.mother = '{$parentid}
                                                 AND 
{$prefix}adoptables.type = {$prefix}owned_adoptables.type 
                                                 ORDER BY 
{$prefix}owned_adoptables.aid";
    
$result runquery($query);
}
else{
    
$query "SELECT * FROM {$prefix}owned_adoptables,  
                            
{$prefix}adoptables  WHERE {$prefix}owned_adoptables.father = '{$parentid}
                                                 AND 
{$prefix}adoptables.type = {$prefix}owned_adoptables.type 
                                                 ORDER BY 
{$prefix}owned_adoptables.aid";
    
$result runquery($query);

Nicely done, you should write a table to display child adoptables info, a good example is provided below, you may modify it to suit your need:

PHP Code:
    $article_content "<table border='1'>
    <tr>
    <th>Image</th><th>Species</th><th>Name</th><th>Level</th><th>TotalClicks</th><th>Owner</th><th>Gender</th>
    </tr>"
;
    while(
$row mysql_fetch_array($result)){
       if(
$row['usealternates'] =='yes')
            { 
                
$image $row['alternateimage']; 
            }
       else
            { 
                
$image $row['primaryimage']; 
            }
       if(
$row['currentlevel'] == 0)
            { 
                
$image $row['eggimage']; 
            }
       if(
$image=='')
            { 
                
$image $row['primaryimage']; 
            }
      
$article_content .= "<tr>
                          <td><center><img src='
{$image}'></center></td>
                          <td><center>
{$row['type']}</center></td>
                          <td><center>
{$row['name']}</center></td>
                          <td><center>
{$row['level']}</center></td>
                          <td><center>
{$row['totalclicks']}</center></td>
                          <td><center>
{$row['owner']}</center></td>
                          <td><center><img src='picuploads/
{$row['gender']}.png'></center></td>
                                  </tr>"
;
    }
    
$article_content .= "</table>"
This may look complicated, but it is the only way I can think of with Arianna's family tree script. Give a try on your site and see if you can set up a page like that.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote