Toronto and Region Conservation
  • Home
  • Heart Lake Conservation Area
  • Claireville Conservation Area
  • Woodbridge
  • Valleywood

Tree Info Test

[insert_php]

$webcodeurl = explode(‘?’,$_SERVER[‘REQUEST_URI’],2);

$con=mysqli_connect(“216.70.94.44″,”acerdb_admin”,”M2Pvzo#G”,”acerdb01″);
//check connection
if(mysqli_connect_errno())
{
echo “Failed to connect to MySQL: ” . mysqli_connect_error();
}

$sqlquery = “SELECT a.Location, a.TreeCode, a.CommonName, a.DBH, a.CW1, a.CW2, a.Height, a.Year, a.Comment, a.UTMN, a.UTME, a.Lat, a.Long, a.KgC, a.KgCO2, a.Webpages, a.Overview, a.ExtraImages, a.ExtraImageDescription, b.ScientificName, b.OtherNames, b.Leaf, b.Flower, b.Fruit, b.Twig, b.Bark, b.Wood, b.Facts, b.Reference, b.Images, b.ImageDescription, b.spcode, b.Footer, c.Weblink, c.Logo, c.LogoDesc FROM tctrcatreeinfo AS a JOIN speciesinfo AS b ON a.CommonName = b.CommonName JOIN locationinfo AS c ON a.Location = c.Location WHERE a.TreeCode LIKE ‘$webcodeurl[1]’ ORDER BY a.Year DESC LIMIT 1”;

$result = mysqli_query($con, $sqlquery);

if(mysqli_num_rows($result)==0){
echo ‘Information on this tree has not been created yet. We will upload the information as soon as we can. Thank you for your patience!’;
}

while($row = mysqli_fetch_array($result))
{
echo ‘

‘ . $row[‘CommonName’] . ‘ (‘ . $row[‘ScientificName’] . ‘)

‘;
echo “
“;
echo “
“;
echo $row[‘Overview’], ‘
‘, ‘
‘;
echo ‘Location: ‘ . $row[‘Location’] . ‘
‘;
echo ‘Lat, Long: ‘ . $row[‘Lat’] . ‘ ,’ . $row[‘Long’] . ‘
‘;
echo ‘TreeCode: ‘ . $row[‘TreeCode’] . ‘
‘;
echo ‘Diameter (DBH): ‘ . $row[‘DBH’] . ‘cm
‘;
echo ‘Last Year Modified: ‘ . $row[‘Year’] . ‘
‘;
echo ‘Carbon Stored in this Tree:‘;
if($row[‘KgC’] == 0)
{echo ‘ No Data
‘;
}
else
{echo ‘ ‘ . $row[‘KgC’] . ‘kg of C
‘;
}
echo ‘Equivalent CO2:‘;
if($row[‘KgCO2’] == 0)
{echo ‘ No Data
‘;
}
else
{echo ‘ ‘ . $row[‘KgCO2’] . ‘kg of C
‘;
}

$img_urls = unserialize($row[‘Images’]);
$img_dsc = unserialize($row[‘ImageDescription’]);
$i=0;
while($i<= (count($img_urls)-1)) { echo '' . $img_dsc[$i] . '‘;
$i++;
}

$speciescode = str_replace(” “,””,$row[‘ScientificName’]);

echo “
“;
echo “
“;
echo ‘Common Name: ‘ . $row[‘CommonName’] . ‘
‘;
echo ‘Scientific Name: ‘ . $row[‘ScientificName’] . ‘
‘;
echo ‘Other Names: ‘ . $row[‘OtherNames’] . ‘
‘;
echo ‘
‘;
echo ‘Leaf: ‘ . $row[‘Leaf’] . ‘
‘;
echo ‘Flower: ‘ . $row[‘Flower’] . ‘
‘;
echo ‘Fruit: ‘ . $row[‘Fruit’] . ‘
‘;
echo ‘Twig: ‘ . $row[‘Twig’] . ‘
‘;
echo ‘Bark: ‘ . $row[‘Bark’] . ‘
‘;
echo ‘Wood: ‘ . $row[‘Wood’] . ‘
‘;
echo ‘
‘;

echo ‘Did you know?
‘;
$b=unserialize($row[‘Facts’]);
$z=0;
while($z<=(count($b)-1)) { $item_nbr = $z+1; echo '‘ . $item_nbr . ‘. ‘ . $b[$z] . ‘
‘;
$z++;
}

//loading the “Find More Trees” link
echo ‘
‘;
echo ‘
‘;
echo ‘‘;

echo ‘
‘;
echo ‘
‘;

//loading links to sponsors and location information.

$logo_urls = unserialize($row[‘Logo’]);
$logo_link = unserialize($row[‘Weblink’]);
$logo_desc = unserialize($row[‘LogoDesc’]);
$j=0;
while($j<= (count($logo_urls)-1)) { echo '‘;
$j++;
}

echo ‘
‘;
echo ‘
‘;

echo ‘Reference
‘;
$r1=unserialize($row[‘Reference’]);
$r2=0;
while($r2<=(count($r1)-1)) { $item_nbr = $r2+1; echo '‘ . $item_nbr . ‘. ‘ . $r1[$r2] . ‘
‘;
$r2++;
}

echo ‘
‘;
echo ‘
‘;

$f1=unserialize($row[‘Footer’]);
$f2=0;
while($f2<=(count($f1)-1)) { echo '‘ . $f1[$f2] . ‘
‘;
$f2++;

}

}
mysqli_close($con);

[/insert_php]

Copyright © 2019, Toronto and Region Conservation Authority.
Association for Canadian Educational Resources

Toronto and Region Conservation Authority

Privacy Policy | Accessibility | Terms of Service