// mysqli_connect('localhost', 'mayabeac_wine', '3]eGo-r(Scru', '3306'); 

// $conn = new mysqli('localhost', 'mayabeac_wine', '3]eGo-r(Scru', 'mayabeac_WineList');
//     if ($conn->connect_errno) 
//         {
//             echo "Failed to connect to MySQL: (" . $conn->connect_errno . ") " . $conn->connect_error;
//         }
//         else{
//         echo "Connected to MySQL";
//         }

mysql_connect('localhost', 'mayabeac_wine', '3]eGo-r(Scru');



mysql_select_db('mayabeac_WineList'); 


$sql="SELECT DISTINCT WineCountry FROM Wines WHERE QtyInStock > 0 ORDER BY WineCountry"; 
$records = mysql_query($sql); 
echo $mysql_result->num_rows;



$linecount=1;

echo "<body><table style='margin-left: auto; margin-right: auto;'>";
       
 echo "<colgroup>";
        echo "<col span='1' style='width: 50%;'>";
        echo "<col span='1' style='width: 50%;'>";
        echo "</colgroup>";


while($wine=mysql_fetch_assoc($records)){
if(!empty($wine['WineCountry'])){

if(wonderplugin_is_device('iPhone,Android,iPad,Windows,Mac')){

  	if($linecount==1){
    	echo "<tr><td><font size='+2'><a ' http://www.bistrowinelist.com/?page_id=622/?Listing=".$wine['WineCountry']."'>".$wine['WineCountry']."</a></font></td>";  	
    }
	else{
	echo "<td ><font size='+2'><a href=' http://www.bistrowinelist.com/?page_id=622/?Listing=".$wine['WineCountry']."'>".$wine['WineCountry']."</a></td></font></tr>";
  	}
  	if($linecount==1){
    	$linecount=2;
        }
  	else{
    	$linecount=1;
              
    }

}
else{

     echo "<tr><td><a href=' http://www.bistrowinelist.com/?page_id=622/?Listing=".$wine['WineCountry']."'>".$wine['WineCountry']."</a></td></tr>";


      }

}
}

if($linecount==2){
  echo "<td></td></tr>"; 
}

echo "</table></body>";