<?php
include('session.php');
include('connection.php');

$i=1;
			mysqli_query($GLOBALS["___mysqli_ston"], "SET NAMES utf8");			
			//$Comp_id="SELECT *  FROM `main_dept_pdf`";
			$Comp_id="SELECT dp.srno,md.dept_name as department_name,sd.dept_sub_category as sub_dep_name,dp.sub_of_sub_dept,
												dp.Date,dp.document1,dp.file_text,dp.Status FROM `main_dept_pdf` dp join main_dept_category md on
												dp.department_name	= md.dept_id join main_sub_dept_cat1 sd on dp.sub_dep_name = sd.sub_dept_code";
			
$res=mysqli_query($GLOBALS["___mysqli_ston"], $Comp_id) or die('Query Failed: 4' . mysqli_error($GLOBALS["___mysqli_ston"]));
		
echo 
"<font size='2'><table border='1' bgcolor='white' style='border-style: solid; border-width: 1px;width:100%;height:50%;'>";

echo '<tr>
					<th scope="col" align="center">srno</th>                     
	    	<th scope="col" align="center">Department Name</th>                     
	    	<th scope="col" align="center">Sub Department Name</th>                     
	    	<th scope="col" align="center">Sub Of Department Name</th>
	    	<th scope="col" align="center">Date</th>
					<th scope="col" align="center">Document</th>
					<th scope="col" align="center">file Text</th>
						<th scope="col" align="center">Status</th> 
			    <th scope="col" align="center">Update</th> 
			  <th scope="col" align="center">Disable</th> 
     ';

echo '</tr>';

	while($rw2 = mysqli_fetch_assoc($res))
	{
				$srno=$rw2['srno'];
				$department_name=$rw2['department_name'];
				$sub_dep_name=$rw2['sub_dep_name'];
				$sub_of_sub_dept=$rw2['sub_of_sub_dept'];
				$Date=$rw2['Date'];
				$document1=$rw2['document1'];
				$file_text=$rw2['file_text'];
				$status=$rw2['Status'];
		
				
echo ' <tr>
    <td onclick="update_company('.$i.')" style="cursor:pointer" title="Click here for edit">'.$i.' </td>
    <td onclick="update_company('.$i.')" style="cursor:pointer" title="Click here for edit">'.$department_name.' </td>
    <td onclick="update_company('.$i.')" style="cursor:pointer" title="Click here for edit">'.$sub_dep_name.' </td>
    <td onclick="update_company('.$i.')" style="cursor:pointer" title="Click here for edit">'.$sub_of_sub_dept.' </td>
    <td onclick="update_company('.$i.')" style="cursor:pointer" title="Click here for edit">'.$Date.' </td>
    <td onclick="update_company('.$i.')" style="cursor:pointer" title="Click here for edit">'.$document1.' </td>
    <td onclick="update_company('.$i.')" style="cursor:pointer" title="Click here for edit">'.$file_text.'</td>
    <td onclick="update_company('.$i.')" style="cursor:pointer" title="Click here for edit">'.$status.'</td>
     ';
  $i++;
echo "<td><button type='button' style='margin-left:0px;width:6em;' value='update' class='submit' onclick='update_company(".$srno .")'/>Update</button></td>";
echo "<td><button type='button' style='margin-left:0px;width:6em;' onclick='view5(".$srno.")'/>Disable</button></td>";
echo '</tr>';
  //		break;
}

Echo "

</table></font>
";		
?>