MyBB Community Forums

Full Version: Database backup help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
INSERT INTO mybb_threads VALUES (a,b,c) (SELECT a,b,c FROM backup_threads WHERE tid IN (1,2,3));

instead of a,b,c look at the table structure of your mybb_threads table, and the backup_threads table, and specify all values that are present in both, in the same order

since I don't know what your table structure looks like I can't give you the exact query, you have to work it out for yourself
(2011-08-25, 09:10 PM)frostschutz Wrote: [ -> ]INSERT INTO mybb_threads VALUES (a,b,c) (SELECT a,b,c FROM backup_threads WHERE tid IN (1,2,3));

instead of a,b,c look at the table structure of your mybb_threads table, and the backup_threads table, and specify all values that are present in both, in the same order

since I don't know what your table structure looks like I can't give you the exact query, you have to work it out for yourself

And is the value the column e.g. tid, fid?
Bump.
ALTER the table that it have the same coloums like the backup

then go to your backup and replace the "INSERT INTO"
with "REPLACE INTO"

Attention:before doing that, backup the current database.
hey if y0u cannot understand what they are saying use this http://mods.mybb.com/view/undo-delete it will w0rk ang y0u can mangange all delated threads ang post ang put them back again
would someone with cpanel permissions be able to do this for me?
(2011-08-25, 09:55 PM)Radebe Wrote: [ -> ]And is the value the column e.g. tid, fid?

yes

example (supposed to be one command)

INSERT INTO mybb_posts
    (`pid`,`tid`,`replyto`,`fid`,`subject`,`icon`,`uid`,`username`,`dateline`,`message`,`ipaddress`,`longipaddress`,`includesig`,`smilieoff`,`edituid`,`edittime`,`visible`,`posthash`)
    (SELECT `pid`,`tid`,`replyto`,`fid`,`subject`,`icon`,`uid`,`username`,`dateline`,`message`,`ipaddress`,`longipaddress`,`includesig`,`smilieoff`,`edituid`,`edittime`,`visible`,`posthash`
      FROM backup_posts WHERE tid IN (1,2,3));

this would be easier if both tables had the same structure then you could just use INSERT INTO table SELECT * FROM other_table WHERE x.

So instead of doing the long query with all values specified you could also see what's different about the table structure and modify the backup table to match...

for example if there was an upgrade in between, you could use a local install (using wampserver or whatever), restore the backup locally, upgrade the backup locally, and then use the now hopefully identical tables
OK thanks, when i use that query (edited for my tables) it says there is an error in the MySQL syntax. I'm using this code:

INSERT INTO mybb_threads
    (`tid`,`fid`,`subject`,`prefix`,`icon`,`poll`,`uid`,`username`,`dateline`,`​firstpost`,`lastpost`,`lastposter`,`lastposteruid`,`views`,`replies`,`closed`,`sticky`,`numratings`,`totalratings`,`notes`,`visible`,`unapprovedposts`,`attachmentcount`,`deletetime`)
    (SELECT `tid`,`fid`,`subject`,`prefix`,`icon`,`poll`,`uid`,`username`,`dateline`,`firstpost`,`lastpost`,`lastposter`,`lastposteruid`,`views`,`replies`,`closed`,`sticky`,`numratings`,`totalratings`,`notes`,`visible`,`unapprovedposts`,`attachmentcount`,`deletetime`)
      FROM backup_threads WHERE tid IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24));
remove ) after the 2nd deletetime
Now i get this error:

#1054 - Unknown column '​firstpost' in 'field list'
Pages: 1 2 3