Hi there,
I have search everywhere for a similar problem or example and cannot find one that helps my code to work. It is a really basic family tree webpage. I am building it as my learning platform.
Following is the PHP code I am using:
<?php
$link = mysql_connect('localhost', 'MY_DB', 'MY_PASSWORD');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
class treeClass
{
public $rowstart = "1";
public $mother = "";
public function fillpoolLrg() {
$loopResult = '';
$events = mysql_query("SELECT name FROM pikiconz_data.tangata WHERE id = '$rowstart'");
while($row = mysql_fetch_array($events)) {
$loopResult .= '
<div class="poolLrg pool">'.$row['name'].'</div>';
$mother = $row['mother'];
}
echo $loopResult;
return $mother;
}
public function fillMedPb2() {
$loopResult = '';
$events = mysql_query("SELECT name FROM pikiconz_data.tangata WHERE id = '$mother'");
if($row = mysql_fetch_array($events)) {
$loopResult .= '
<div class="poolMed pool">'.$row['name'].'</div>';
} else {
$loopResult .= '
<div class="poolMed pool">'.'ADD'.'</br>'.'PERSON'.'</div>';
}
echo $loopResult;
}
}
?>
So, for the life of me I just can not get this code to display the div that is in the function.
It works if I remove the class.. just not WITH the class..
I have looked everywhere and can not help but think it is either something really simple OR I am using classes in a completely erroneous way.
Any help, thoughts or general advice on where to head for answers would be greatly appreciated!
Thank you in advance.
Castor