<?php include("session_start.php");
include("session_check.php");
include("database.php");
if($_GET['q']!="")
{	
	$q=$_GET["q"];
	
	
	$sql="select t1.type,t1.ward_office,t1.ward,t2.tree_name from input_form as t1 left join info as t2 on t1.id = t2.aid where t1.type= '$q'  ";
	//echo "select t1.type,t2.tree_name from input_form as t1 left join info as t2 on t1.id = t2.aid where t1.type= '$q'  "; exit;
	//echo "SELECT * FROM input_form WHERE city= '$q'   ";
	$rest=mysql_query($sql);
	$num = mysql_num_rows($rest); 
	
	if($num >0)
	{
		?>
    <a href="print_category_tree_type_total.php?q=<?php echo $q?>"> 
    <input type="button" bgcolor="#a9c1de" name="print" id="print" value="Print" style="text-decoration:none" class="button_c" onClick=""></a>
    <br /><br />
    <?php
		echo "<b>Total Number of Trees In The City are :".$num ;
		echo "<br><br>";
		?> 
    
    <table border="1" cellpadding="2" cellspacing="2" width="100%" align="center" bordercolor="#bcd5e7" >
	   
	 <tr>
    	<td align="left"><font class="font4"><b>Ward Office</font></td>
        <td align="left"><font class="font4"><b>Sub ward</font></td>
        <td align="left"><font class="font4"><b>Category of Tree</font></td>
        <td align="left"><font class="font4"><b>Tree Names</font></td>
 
     </tr>
     <?php
   while ($row =@mysql_fetch_object($rest)) 
{
	$query_ward = mysql_query("select * from master_ward where wid= '".$row->ward_office."'");
	$result_ward = mysql_fetch_array($query_ward);
	
	$query_sub = mysql_query("select * from master_ward_drop where did= '".$row->ward."'");
	$result_sub = mysql_fetch_array($query_sub);
	
	$query_tree = mysql_query("select * from tree_name where tid= '".$row->tree_name."'");
	$result_tree = mysql_fetch_array($query_tree);
	
	echo "<tr>";
echo "<td  align='left'>"."<div align='left'>"."<font class='font4'>".$result_ward['wvalue']."</font></div></td>";
echo "<td  align='left'>"."<div align='left'>"."<font class='font4'>".$result_sub['dvalue']."</font></div></td>";	
echo "<td  align='left'>"."<div align='left'>"."<font class='font4'>".$row->type."</font></div></td>";
echo "<td  align='left'>"."<div align='left'>"."<font class='font4'>".$result_tree['tree_name']."</font></div></td>";

}?>

</table>
    
<?php }else
{
	echo "No Records To Display";
}
}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Survey Application</title>
</head>

<body>
</body>
</html>