<?php

error_reporting(E_ALL);
ini_set('display_errors', 'On');
$con = mysqli_connect("localhost", "root", "Hassan2015", "worldcup") or die(mysql_error());
$client = new SoapClient("http://footballpool.dataaccess.eu/data/info.wso?wsdl");
//------------------------AllPlayerNames------------------------------------
$result = $client->AllPlayerNames(array("bSelected" => 1));
$AllPlayerNames = $result->AllPlayerNamesResult->tPlayerNames;
foreach ($AllPlayerNames as $k => $v) {
    $sql = "insert into player(player_id,player_name) values('{$v->iId}','{$v->sName}')";
    mysqli_query($con, $sql);
}
//------------------------AllDefenders------------------------------------
$result = $client->AllDefenders(array("sCountryName" => ""));
$Alldefenders = $result->AllDefendersResult->string;
foreach ($Alldefenders as $k => $v) {
    $sql = "UPDATE player SET position='defender'WHERE player_name='{$v}'";
    mysqli_query($con, $sql);
}
//------------------------AllGoalKeepers------------------------------------
$result = $client->AllGoalKeepers(array("sCountryName" => ""));
$Allgoalk = $result->AllGoalKeepersResult->string;
foreach ($Allgoalk as $k => $v) {
    $sql = "UPDATE player SET position='goal_keeper'WHERE player_name='{$v}'";
    mysqli_query($con, $sql);
}
//------------------------AllForwards------------------------------------
$result = $client->AllForwards(array("sCountryName" => ""));
$AllForwards = $result->AllForwardsResult->string;
foreach ($AllForwards as $k => $v) {