Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- mysql_connect();
- // Get the last id of player
- $lastPlayerId = mysql_fetch_array(mysql_query("SELECT id FROM players DESC"))[0];
- // Get the last id of account
- $lastAccountId = mysql_fetch_array(mysql_query("SELECT id FROM accounts DESC"))[0];
- // Connect to the other database
- //disconnect from the first
- mysql_connect();
- // Start updating the ids of players
- $i = 0;
- for(;;) {
- if (mysql_error())
- break;
- $i++;
- $newPId = $lastPlayerId + $i;
- $newAId = $lastAccountId + $i;
- // Update the foreign dependent tables
- mysql_query("UPDATE accounts SET id = ".$newAId." WHERE id = ".$i."");
- mysql_query("UPDATE players SET account_id = ".$newAId." WHERE id = ".$i."");
- mysql_query("UPDATE players SET id = ".$newPId." WHERE id = ".$i."");
- mysql_query("UPDATE player_skill SET player_id = ".$i." WHERE id = ".$newPId."");
- mysql_query("UPDATE player_items SET player_id = ".$i." WHERE id = ".$newPId."");
- mysql_query("UPDATE player_depotitems SET player_id = ".$i." WHERE id = ".$newPId."");
- mysql_query("UPDATE player_storage SET player_id = ".$i." WHERE id = ".$newPId."");
- }
- // Merge them all!
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement