
 <div style="background-color:#FFF; height: auto;">
 
     <table style='width:100%; height:auto;' cellpadding='0' cellspacing='0' border='0' align="center">
     
     <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
 
 
 <?php 	include('config/database_connection.php'); 
 
 				
 	$display = "";
	$connecttion = getSQLConection();
	
	$arr1 = array('A', 'C', 'E', 'G');
	$arr2 = array('B', 'D', 'F', 'H');
	$j = 0;
	for($i = 0; $i < 8; $i = $i + 2)
	{
		$query = " Select country, Lower(SUBSTRING(country, 1, 3)) as prefix, group_name From dbo.tbl_group WHERE group_id = $i ";
		$result = sqlsrv_query($connecttion, $query);


		$display .= "<tr><td style='width:50%;'  align='center' valign='top'>";
		
		$display .= "<div style='background:#060; color:#FFF;width:70%; text-align:left;' >&nbsp;Group : $arr1[$j]</div> ";
		
		$display .= "<table style='width:70%; height:auto;' cellpadding='0' cellspacing='5' border='0' >";
		
		while($row = sqlsrv_fetch_array($result))
		{
			$display .= "<tr>
				<td style='width:70%; height:auto; font-family:Verdana, Geneva, sans-serif; font-size:12px; font-weight:bold;color:#000;' align='left' valign='top'>
				$row[0]
				</td>
				<td style='width:30%; height:auto;' align='center' valign='top'>
				  <img class='magnify' width='50' height='30'  align='middle' src='images/country/$row[1].png' />
				</td>
			</tr> ";
			
		} 
		
		 $display .= "</table></td>";
	
	
		$query = " Select country, Lower(SUBSTRING(country, 1, 3)) as prefix, group_name From dbo.tbl_group WHERE group_id =   ". ($i + 1);
		$result = sqlsrv_query($connecttion, $query);
	
		$display .= "<td style='width:50%;'  align='left' valign='top'>";
		
		$display .= "<div style='background:#060; color:#FFF;width:70%; text-align:left;' >&nbsp;Group : $arr2[$j]</div> ";
	
		$display .= "<table style='width:70%; height:auto;' cellpadding='0' cellspacing='5' border='0' >";
		
		while($row = sqlsrv_fetch_array($result))
		{
			$display .= "<tr>
				<td style='width:70%; height:auto; font-family:Verdana, Geneva, sans-serif; font-size:12px; font-weight:bold;color:#000;' align='left' valign='top'>
				$row[0]
				</td>
				<td style='width:30%; height:auto;' align='center' valign='top'>
				  <img class='magnify' width='50' height='30'    align='middle' src='images/country/$row[1].png' />
				</td>
			</tr> ";
			
		} 
		
		 $display .= "</table></td><tr>";
		 
		 $j++;
	 
	}

 	closeSQLConnection($connecttion);
 
 
 
 
 echo $display;
 
 ?>

      <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
</table>
 

	 