Desired teams

[insert_php]
$type =$_GET[‘type’];
//$type =intval($type);
$country=$_GET[‘country’];
$town=$_GET[‘state’];

//Conexión
//Conecta a base de datos
$connection=mysql_connect(‘localhost’,’sportteamsaroun’,’Currais1988′);
mysql_select_db(“sportteamsaroun”,$connection);
mysql_set_charset(‘utf8’);

if($type==”sport” && $country==””)
{
$query=”SELECT * FROM sport_data_list_table”;
}
elseif($type==”sport” && $country!=”” && (empty($town) || $town==”))
{
$query=”SELECT * FROM sport_data_list_table WHERE country='”.$country.”‘”;
}
elseif($type==”sport” && $country!=”” && (!empty($town) || $town!=”))
{
$query=”SELECT * FROM sport_data_list_table WHERE country='”.$country.”‘ AND town='”.$town.”‘”;
}
elseif($type!=”sport” && $country!=”CA” && $country!=”GZ”)
{
$query=”SELECT * FROM sport_data_list_table WHERE id_sport='”.$type.”‘”;
}
elseif($type!=”sport” && $country!=”” && (empty($town) || $town==”))
{
$query=”SELECT * FROM sport_data_list_table WHERE country='”.$country.”‘ AND id_sport='”.$type.”‘”;
}
elseif($type!=”sport” && $country!=”” && (!empty($town) || $town!=”))
{
$query=”SELECT * FROM sport_data_list_table WHERE country='”.$country.”‘ AND town='”.$town.”‘ AND id_sport='”.$type.”‘”;
}
else
{
$query=”SELECT * FROM sport_data_list_table”;
}

//Conecta a base de datos
$que = mysql_query($query,$connection);
echo mysql_error();

//Creamos a táboa
echo “

“;

echo “

“;
while($celas=mysql_fetch_assoc($que))
{
echo “

“;
//DEPORTE
$queSportType = ‘SELECT * FROM sport_list_table’;
$queSpoTyp = mysql_query($queSportType,$connection);
echo “

“;

//CATEGORIAS
//QUERIES
$queCategories = “SELECT * FROM sport_category_list_table”;
$queCat = mysql_query($queCategories,$connection);

echo “

“;

//SITUACIÓN
if($celas[‘town’] != null)
{
echo “

“;
}

if($celas[‘country’]==’CA’)
{
echo “

“;
}
elseif($celas[‘country’]==’GZ’)
{
echo “

“;
}

//COMMENT
if($celas[‘comment’] != null)
{
echo “

“;
}
//EMAIL
if($celas[’email’] != null)
{
echo “

“;
}
//Phone
if($celas[‘phone’] != null)
{
echo “

“;
}
//web
if($celas[‘website’] != null)
{
echo “

“;
}
}
echo “

Teams and clubs
“.$celas[‘team_name’].”
“;
while ($wantedSportTypeID = mysql_fetch_assoc($queSpoTyp))
{
if(intval($celas[‘id_sport’]) == intval($wantedSportTypeID[‘id’]))
{
echo $wantedSportTypeID[‘sport_en’];
}
}
echo mysql_error();
echo “
“;
while ($category=mysql_fetch_assoc($queCat))
{
//TÁBOA DE DATOS
$queCategoriesData = “SELECT * FROM sport_category_data_list_table WHERE id_category='”.$category[‘id’].”‘ AND id_team='”.$celas[‘id’].”‘”;
$queCatDat = mysql_query($queCategoriesData,$connection);

while ($categoryData=mysql_fetch_assoc($queCatDat))
{
if($category[‘id’]==$categoryData[‘id_category’])
{
echo $category[‘category_en’].” / “;
}
}
}
echo “

“;
if($celas[‘address’] != null)
{
echo $celas[‘address’];
}
echo ” (“.$celas[‘town’].”)
Catalunya
Galicia
“.$celas[‘comment’].”
“.$celas[’email’].”
“.$celas[‘phone’].”
“.$celas[‘website’].”

“;
[/insert_php]