$data = validate_id($id_player, 'id_rotoworld'); $this_id_rotoworld = $data['id_rotoworld']; if ($id_rotoworld != $this_id_rotoworld) { writelog($logFile, "info", "\tJoueur {$playerName} ({$id_player}) : id_rotoworld différent (2)"); $q = "update nhl_players set id_rotoworld={$id_rotoworld} where id = {$id_player} and date_expiration = '2099-12-31';"; insert_query_in_file($INSERTFILE, $q); } // ajout/update dans la table de corr. insert_or_update_corr_values($INSERTFILE, $id_player, $playerName, $birthdate); } else { // on a trouvé le joueur $data = $data[0]; $id_player = $data['id']; $this_id_rotoworld = $data['id_rotoworld']; if ($this_id_rotoworld != $id_rotoworld) { writelog($logFile, "info", "\t Joueur {$playerName} ({$id_player}): id_rotoworld différent"); $q = "update nhl_players set id_rotoworld=\"{$id_rotoworld}\" where id = {$id_player} and date_expiration = '2099-12-31';"; insert_query_in_file($INSERTFILE, $q); } // ajout/update dans la table de corr. insert_or_update_corr_values($INSERTFILE, $id_player, $playerName, $birthdate); } } } } //print_r($birthdateA); writelog($logFile, "info", "Closing the connexion to the database..."); DB::dbClose(); writelog($logFile, "info", "Closed"); writelog($logFile, "info", "To update the database, load the file {$INSERTFILE}"); writelog($logFile, "info", "DONE");
DB::dbInsert($query); $query = "insert into nhl_players_temp\n select * from nhl_players\n where id = {$id_player}\n and date_expiration = '{$today}'"; DB::dbInsert($query); $query = "update nhl_players_temp set team={$my_id_team},date_expiration='2099-12-31',date_activation='{$today}'\n where id = {$id_player}\n and date_expiration = '{$today}'"; DB::dbUpdate($query); $query = "insert into nhl_players\n select * from nhl_players_temp\n where id = {$id_player}\n and date_expiration = '2099-12-31'"; DB::dbInsert($query); } } // champ id_forecaster de la table nhl_players if ($id_forecaster != $my_id_forecaster) { $query = "update nhl_players set id_forecaster={$my_id_forecaster} where id = {$id_player} and date_expiration = '2099-12-31';"; insert_query_in_file($INSERTFILE, $q); } // ajout dans la table de corr. si nécessaire insert_or_update_corr_values($INSERTFILE, $id_player, $full_name_corr, $birthdate); // update de la position du joueur // N.B. Si la position change de D/G vers un avant, on écrit dans le log et on fait rien... $query = "select pos from nhl_players\n where id = {$id_player}\n and date_expiration = '2099-12-31'"; $data = DB::dbSelect($query); $data = $data[0]; $pos = $data['pos']; switch ($this_pos) { case 'D': if ($pos != "D" && $pos != "" && $pos != " ") { writelog($logFile, "warning", "{$full_name_corr} : pos table: {$pos}, pos site: {$this_pos} (in case D)"); } elseif ($pos == "") { $q = "update nhl_players set pos='{$this_pos}' where id = {$id_player} and date_expiration = '2099-12-31';"; insert_query_in_file($INSERTFILE, $q); } break;