<?php
/*Connect to the local server using Windows Authentication and
specify the AdventureWorks database as the database in use. */
$serverName = "NEODREAMOFFICE";
$me = 'sa';
$med = 'Prayer12@';
$connectionInfo = array( "UID" => "$me",  "PWD" => "$med");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false)
{
     echo "Could not connect.\n";
     die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT updatemonth,updateyear, Count(updatemonth)as size
  FROM [nelson].[dbo].[NewEntrants] group by updatemonth ,updateyear order by updateyear desc , updatemonth desc";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
} 
	
  ;?>
<table width="600" border="1" align="center" cellpadding="5" cellspacing="4">
  <tr>
    <th scope="col">MOnth</th>
    <th scope="col">Year</th>
    <th scope="col">Size</th>
  </tr>
  <tr>
  <?
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {?>
     
	 	 	  <td><? 
if ($row['updatemonth'] == 1) {echo 'January';}
	 else if ($row['updatemonth'] == 2) {echo 'Febuary';}
 	 elseif ($row['updatemonth'] == 3) {echo 'March';}
	 elseif ($row['updatemonth'] == 4) {echo 'April';}
	 elseif ($row['updatemonth'] == 5) {echo 'May';}
	 elseif ($row['updatemonth'] == 6) {echo 'June';}
	 elseif ($row['updatemonth'] == 7) {echo 'July';}	 	           
	 elseif ($row['updatemonth'] == 8) {echo 'August';}
	 elseif ($row['updatemonth'] == 9) {echo 'September';}
	 elseif ($row['updatemonth'] == 10) {echo 'October';}
	 elseif ($row['updatemonth'] == 11) {echo 'November';}
	 elseif ($row['updatemonth'] == 12) {echo 'December';}; ?></td>
      <td><? echo $row['updateyear']; ?></td>
      <td><? echo $row['size']; ?></td>
   </tr>  <?
}

sqlsrv_free_stmt( $stmt);


?>
  
</table> 
<?
/* Free the statement and connection resources. */

sqlsrv_close( $conn);
?>