$teamid = "select team_id from team where team_name='{$v->sTeamName}'"; $teamID = $con->query($teamid); if ($teamID->num_rows > 0) { while ($row = $teamID->fetch_assoc()) { $t_id = $row["team_id"]; /*fe mshkla f haza elsatr ell3en*/ $gameid = "select game_id from game where play_date='{$v->dGame}' AND (team1_id={$t_id} OR team2_id={$t_id})"; $gameID = $con->query($gameid); if ($gameID->num_rows > 0) { while ($row1 = $gameID->fetch_assoc()) { $id = $row1["game_id"]; $goalID = $k + 1; $sql = "update goal SET game_id = {$id} WHERE goal_id='{$goalId}'"; mysqli_query($con, $sql); } } } } } //---------------------------AllStadiumInfo----------------------------------- $result = $client->AllStadiumInfo(array()); $Stadiuminfo = $result->AllStadiumInfoResult->tStadiumInfo; foreach ($Stadiuminfo as $k => $v) { $sql = "insert into stadium(stadium_name,seat_capacity,city,wikipedia_URL)values('{$v->sStadiumName}','{$v->iSeatsCapacity}','{$v->sCityName}','{$v->sWikipediaURL}')"; mysqli_query($con, $sql); $result = $client->StadiumURL(array("sStadiumName" => $v->sStadiumName)); $Stadiumurl = $result->StadiumURLResult; $sql = "UPDATE stadium SET google_maps_url='{$Stadiumurl}' WHERE stadium_name='{$v->sStadiumName}'"; mysqli_query($con, $sql); } //header( "Location: tables.php" );