PDA

View Full Version : changing table thread


mark58
Tue 11th May '04, 8:07pm
what is the sql code to change forumid=106 to forumid=146 in table thread?

this will catch you up on my situation

http://www.vbulletin.com/forum/showthread.php?p=670021#post670021

Steve Machol
Tue 11th May '04, 8:25pm
Just manually edit that row with phpMyAdmin.

mark58
Tue 11th May '04, 8:38pm
Just manually edit that row with phpMyAdmin.
in table thread, there would be 100's of rows to edit. there is around 300k posts so probably ballpark 10-15k rows that would have to edited.

i tried to edit the new forum 146 to change it to 106 but for some reason it didn't work with the rest of the site. that is why i thought i would try to edit the forumid in the thread table to point to the new 146 forum rather than the old 106 forum

Steve Machol
Tue 11th May '04, 8:49pm
No you misunderstood. Assunming that you still have all those threads pointing to forumind 106, all you need to do is renumber the new forum to forumid 106. You just have to change one entry in the forum table.

mark58
Tue 11th May '04, 8:58pm
No you misunderstood. Assunming that you still have all those threads pointing to forumind 106, all you need to do is renumber the new forum to forumid 106. You just have to change one entry in the forum table.
i created a new forum in the admincp

went into phpmyadmin and edited the forum table - changing forumid from 146 to 106. checked it to make sure it saved, it did

went and rebuilt the thread information and then the forum information in the admincp area

checked the forum home and it still pointed to 146...

legolas
Tue 11th May '04, 9:32pm
You must have the opposite problem now.

There must be some db reference(s) -- probably only a few -- to forum 146, and you need to change them (all) to 106.

----cut----
#!/bin/bash
DBNAME=
# e.g. DBNAME="vbulletin -uUSER -pPASSWORD" if you need a user and password.
if [ "x$DBNAME" == "x" ]; then
echo "You have to fix DBNAME in the script."
exit 200
fi
for i in access announcement forum forumpermission moderator moderatorlog subscribeforum thread; do
#mysql $DBNAME -e "update $i set forumid=106 where forumid=146"
mysql $DBNAME -e "select * from $i where forumid=146"
done
----cut----

If you see any output, you can either uncomment the first mysql line and comment out the second one, or you can ditch the script and run the first mysql line against only the table that has the bad reference. If you uncomment the update line, you do so at your risk.