<?php error_reporting(0);
include("../../include/db.php");
$show = 20;
$num_links = 19;
$from = $_GET['from'];
if (empty($from))
	 {
		$from = "0";
	 } 
else 
	{
	$html_query = $html_query. "&from=$from";
	}
$sql="select * from  group_creation"; 
$html_query = "main_fram.php?file=group_creation";
$result=mysql_query($sql);
$num_results=mysql_num_rows($result);
if ($num_results == 0) 
{
 $confirmation = "No Records!";
} 
elseif ($num_results == 1) 
{
$confirmation = "Found 1 Record.";
} 
else 
{
$confirmation = "Found $num_results Records.";
} 
 function groupname($groupid)
  {
  
	$sql_grp="select * from group_creation where sub_grpid='$groupid' ";
	$rs_grp=mysql_query($sql_grp);
	$rscount_grp=mysql_num_rows($rs_grp);
	while($rsdata_grp=mysql_fetch_object($rs_grp))
	{ 
	$group_name=$rsdata_grp->sub_group_name;
	}
	return $group_name;
}
?>
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
</style>
<div class="container">
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<div class="CSSTableGenerator">  

<table border="0" width="100%"  align="center" cellpadding="0" cellspacing="0" >
<thead>
<tr>
    <th  align="center" width="12">S.No</th>
    <th  align="left" >Group Name</th>
    <th  align="left" >Sub Group</th>
    <th  width="43">Edit</th>
    <th  width="49">Delete</th>
</tr>


  <?php
include("../../include/db.php");
 $sql="select * from  group_creation order by sub_grpid DESC LIMIT $from,20 ";
    $rs=mysql_query($sql);
	$sno=0;

   while($rsdata=mysql_fetch_array($rs))
  {
   $sno=$sno+1;
   $from=$from+1;
   $group_id=$rsdata['sub_grpid'];
   $groupid=$rsdata['group_id'];
   $group_name1=groupname($groupid);
   $group_name=$rsdata['sub_group_name'];
   $group_remarks=$rsdata['group_remarks'];
 ?>
  <tr>
    <td width="12"  align="center"><?php echo $from; ?></td>
    <td width="63" align="left" >&nbsp;<?php echo $group_name;?></td>
    <td width="31" align="left" >&nbsp;<?php echo $group_name1;?></td>
    <td align="center"><img src="img/edit.png" width="17" height="20" title="EDIT" onclick="javascript:add_new_group('master_entry/group_creation/group_entry.php?edit_id=<?php echo $group_id;?>')"/></td>
    <td align="center" ><a href="#" onClick="group_delete_row('<?php echo $group_id;?>');"><img src="img/cross_deletes.png" alt="delete" title="DELETE" border="0" width="15px;" height="15px;" /></a>   </td>
  </tr>
  <?php } ?>
  </thead>
</table>
</div>
<table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0" >

 <tr>
    <th height="19" align="left" style="font-size:12px; font-family:sans-serif; padding-top:10px;" scope="col"><?php echo $confirmation;?></th>
	<th scope="cols" width="8%" align="right"><?php  
			  if ($num_results > $show) 
			  {
			  $show;
			include("include/footer_links.php");
			  }
	?></th>
 </tr>
</table>
</div>
</div>
</div>

