<?php
  session_start();
$username = $_SESSION['User_Name'];

include_once('connection/db.php');
 require_once('convert_marathi.php');
 
$given_cnt=$_GET['cnt'];



?>
<table id="" class="table table-bordered">
	<thead>
		<tr>
			<th class="head0 center"> कोणाकडून प्राप्त झाले </th>
			<th class="head1 center"> मोबाईल नं. </th>
			<th class="head0 center"> Count </th>
		</tr>
	</thead>
	<tbody>	
		<?php	
		
		convert_marathi();
		$qry8=("SELECT sender_name, mobile_no, COUNT(*) as cnt from incoming_letters_transaction i, tapal_to_dpt_transaction t
		where  i.ltr_id=t.ltr_id
		AND t.dept_id_from=(select dept_id from login where login_id='$username') 
		GROUP BY sender_name,mobile_no ORDER BY cnt DESC");

		$rs8=mysql_query($qry8) or die("".mysql_error());
		$cn=mysql_num_rows($rs8);
		//echo $cn;
		
		while($rws=mysql_fetch_array($rs8))
		{	
			
			$sender_name= $rws['sender_name'];
			$mobile_no= $rws['mobile_no'];
			$cnt= $rws['cnt'];
			
			if($cnt>=$given_cnt)
			{
				echo "<tr class='gradeX'>";
			
				echo "<td class='center'>".$sender_name." </td>
				<td class='center' >".$mobile_no." </td>
				<td class='center' ><a href='view_freq1.php?sender_name=".$sender_name."&mobile_no=".$mobile_no."'>".$cnt." </a></td>";
				
				echo "</td>
				</tr>";
			}
				
				
						
		}
		
		?>
	</tbody> 
</table>