$variable = $_GET['Listing'];

$connection = mysql_connect('localhost', 'mayabeac_wine', '3]eGo-r(Scru');
mysql_query("SET NAMES 'utf8'");

mysql_select_db('mayabeac_WineList'); 

echo $variable;      
     
      echo "<b><span style=' display: inline-block; text-align: left; width:85%; line-height: 150%; font-size: 200%'>".$variable."</span></b><br>";
       $wineTypes = array();
       $wineTypes[1] = "Sparkling";
       $wineTypes[2] = "White";
       $wineTypes[3] = "Rose";
       $wineTypes[4] = "Red";
       $wineTypes[5] = "Dessert";
 
        for ($x = 1; $x <= 5; $x++) {

       
      
    	

     	$sql="SELECT * FROM Wines WHERE QtyInStock>0 AND WineCountry='".$variable."' AND WineType='".$wineTypes[$x]."' ORDER BY WinePrice";
      	$records1=mysql_query($sql);
 
      	$recordcount=1;
      	while($wines=mysql_fetch_assoc($records1)){
       
               if($recordcount == 1){
               
             
              echo "<b><span style='text-align: left; width:85%; line-height: 150%; display: inline-block; font-size: 1.5em'>".$wineTypes[$x]."</span></b><br>";
	       $recordcount = 2;
               }
          echo "<div style='line-height: 100%;'>";
          if($wines['WineVintage']==0){
          	
            $vintage=NULL;	
          }
          else{
          	$vintage=$wines['WineVintage'];
          }
         if($wines['QtyInStock'] < 3){  
          $lowStock = "* ";
          }
          else{
          $lowStock = "";
           }

           if($wines['WineSize']<750){
           $sizeinfo="&nbsp (small bottle)";
            }
            else{
            $sizeinfo="";
             }
             $wineID="<b><a href='http://192.168.104.254/wordpress/single-item?WineID=".$wines['ID']."&listType=byCountry&listName=".$variable."&linkCount=1'>".$lowStock.$wines['WineName'].$sizeinfo."&emsp;".$vintage."</a></b>";
            
            
     echo "<div style='line-height: 140%;'>";
            echo "<span style='display: inline-block; font-size: 1.25em; text-align: left; width:85%;'>".$wineID."</span>";

                $winePrice="<b>$".$wines['WinePrice']."</b>";
                echo "<span style='display: inline-block; font-size: 1.25em; text-align: right; width:15%;'>".$winePrice."</span><br>"; 
             
               $wineCountry=$wines['WineRegion'];

               if($wines['WineVarietal']!=""){
                              
                       $wineVarietal=$wines['WineVarietal'];
                      
                       echo "<span style=' display: inline-block; text-align: left; width:85%;'>".$wineVarietal."</span><br>";

                  }

		echo "<span style=' display: inline-block; text-align: left; width:85%;'>".$wineCountry."</span><br>";
                
                
               echo "<br>";
                        	
      	  echo "</div>";
        }
      
  
}
echo "<br><font size='-1'>All prices are in Belize Dollars and include 12.5% GST (Sales Tax). BZ$2 = US$1<font>";