I have 2 sets of 2 tables with identical columns, set up some 15 years ago:
alt_subjects
alt_posts
board_subjects
board_posts
There's an ID column in alt_subjects that corresponds to alt_posts, and in board_subjects that corresponds to board_posts.
I realized a long time ago that it would have been better to have alt_posts and board_posts in one table, then alt_subjects and alt_posts in a table with a column for "category" or something. But I've been procrastinating because it's a daunting task :-/
The best I can figure is to:
A. add a column to alt_subjects called "new_ID"
Then write a PHP script that will:
1. Select all of the alt_subjects and store it in an array
2. Read the last ID in board_subjects, then in a loop modify the alt_subjects array to reassigns a new ID to each row, and create an associative array to link the original ID to the new ID
3. Insert the updated alt_subjects array into board_subjects
4. Update alt_subjects with the new ID in the "new_ID" column
5. Select all of the alt_posts and store it in an array
6. Update the array with the new ID from the associative array in #2
7. Insert the update alt_posts array into board_posts
8. Modify my public script so that if the user is looking at what was once alt_subjects and the ID is less than the last ID at the time of the merge, select the new ID from alt_subjects and re-select from board_subjects
That feels like a long and tedious process! Before I jump in head first, is there an easier way?