Page 4 of 8

Posted: Tue Mar 23, 2004 11:20 am
by NEC4EVER
It seems i got the same problem as FIREJACK :(

This is with the same database

Code: Select all

$dbms = 'mysql';
$phpbb_root_path = '';

$dbhost = 'localhost';
$dbuser = 'necforum';
$dbpasswd = 'basje123';


// Name and prefix for the database that should keep the original IDs
$dbname1 = 'necforum_nec';
$table_prefix1 = 'necphp_';

// Name and prefix for the database that is going to be added
// to DB1.
$dbname2 = 'necforum_nec';
$table_prefix2 = 'forum_';
Merging categories table:

SQL Error : 1146 Table 'necforum_nec.necphp_necphp_categories' doesn't exist

INSERT INTO necforum_nec.necphp_necphp_categories (cat_id, cat_title, cat_order) SELECT cat_id, cat_title, cat_order from necforum_nec.forum_necphp_categories

Line : 277
File : /home/necforum/public_html/phpBB2/merge.php

This is with an other database

Code: Select all

$dbms = 'mysql';
$phpbb_root_path = '';

$dbhost = 'localhost';
$dbuser = 'necforum';
$dbpasswd = 'basje123';


// Name and prefix for the database that should keep the original IDs
$dbname1 = 'necforum_nec';
$table_prefix1 = 'necphp_';

// Name and prefix for the database that is going to be added
// to DB1.
$dbname2 = 'necforum_xmb1';
$table_prefix2 = 'forum_';
Merging categories table:

SQL Error : 1146 Table 'necforum_nec.necphp_necphp_categories' doesn't exist

INSERT INTO necforum_nec.necphp_necphp_categories (cat_id, cat_title, cat_order) SELECT cat_id, cat_title, cat_order from necforum_xmb1.forum_necphp_categories

Line : 277
File : /home/necforum/public_html/phpBB2/merge.php[/code]

Posted: Tue Mar 23, 2004 12:25 pm
by NEC4EVER
6-Kid wrote:
Firejack wrote:
Merging categories table:

SQL Error : 1146 Table 'test.phpbb_phpbb_categories' doesn't exist


:?:

Thanks for any help.


change this in the script to fix it :
in the part where it say's function merge_tables($table)

--- look for ---

$sql = "INSERT INTO $dbname1.$table_prefix1".$table." ($fieldlist) SELECT $fieldlist from $dbname2.$table_prefix2" . $table . $where;
if(!$db->sql_query($sql))
--- end look ---

-- change --

$sql = "INSERT INTO $dbname1.".$table." ($fieldlist) SELECT $fieldlist from $dbname2." . $table . $where;

-- end change --

that's how i got it to work..


I have done this but now i have the following problem:
Merging categories table:

SQL Error : 1062 Duplicate entry '20' for key 1

INSERT INTO necforum_nec.necphp_categories (cat_id, cat_title, cat_order) SELECT cat_id, cat_title, cat_order from necforum_nec.necphp_categories

Line : 277
File : /home/necforum/public_html/phpBB2/merge.php

Posted: Fri Mar 26, 2004 8:17 am
by Joe Belmaati
Any chance that this script can be put back online? I tried to use Bart's link, but there doesn't appear to be a file there any more..
Thank you very much,
Joe Belmaati
Copenhagen Denmark

Posted: Thu Apr 15, 2004 4:35 am
by CMA
I am sorry that I revive this thread... I have to

I was trying do that quote
6-Kid wrote:
Firejack wrote:
Merging categories table:

SQL Error : 1146 Table 'test.phpbb_phpbb_categories' doesn't exist


:?:

Thanks for any help.


change this in the script to fix it :
in the part where it say's function merge_tables($table)

--- look for ---

$sql = "INSERT INTO $dbname1.$table_prefix1".$table." ($fieldlist) SELECT $fieldlist from $dbname2.$table_prefix2" . $table . $where;
if(!$db->sql_query($sql))
--- end look ---

-- change --

$sql = "INSERT INTO $dbname1.".$table." ($fieldlist) SELECT $fieldlist from $dbname2." . $table . $where;

-- end change --

that's how i got it to work..


and I still get same error

Code: Select all

Line : 276
File : /home/***/public_html/forums/merge_phpbb.php
So I have one user name and different database names

I still don't understand what is that error. can you explain this?

Posted: Thu Apr 15, 2004 3:13 pm
by CMA
:? Can someone please help me?

Posted: Thu Apr 15, 2004 10:52 pm
by CMA
is there no solution for that? :|

Posted: Thu Apr 29, 2004 4:31 am
by Snorii
Firejack wrote: Hello

I've been testing this script but it doesn't want to seem to work for me. This is the output from when I run the script.
Merging categories table:

SQL Error : 1146 Table 'test.phpbb_phpbb_categories' doesn't exist

INSERT INTO test.phpbb_phpbb_categories (cat_id, cat_title, cat_order) SELECT cat_id, cat_title, cat_order from test.phpbbsw_phpbb_categories

Line : 277
File : /home/firejack/public_html/merge.php


Any ideas why the script ends up trying to write DB2 to a double prefixed table,

Merging categories table:

SQL Error : 1146 Table 'test.phpbb_phpbb_categories' doesn't exist


:?:

Thanks for any help.

Firejack wrote: I've successfully used this script! Many thanks to Bart for this excellent script :)

I had to use a slight work around for the script to work for me.
I removed the phpbb_ prefix in DB1. This has the result of removing the double prefixing problem because my way of thinking was nothing + nothing = nothing ;)
After running the script it was a simple matter of inserting the table prefix phpbb_ into all my tables again.


This also worked for me. I used phpMyAdmin and changed each table so there was no prefix. There may be an easier way but I opened the table, clicked operations, then beside "Rename table to :" removed the phpbb_ part and hit go. I did this for all the tables.

Then after the script ran successfully, I put phpbb_ back in front of the table name.

Thanks for the script Bart. It saved me lots of work. :D Thanks for the work-around Firejack. :D

Posted: Tue Jun 08, 2004 5:06 am
by DianaRae
Question please.

After about 7 hours I finally got this to work.

Or so I thought. :?

This is a test forum before I do the live one. there are nearly 23,000 posts.

The merged topics are showing up on the forums..& it even shows the #'s of topics that are supposed to be there.

http://www.dianarae.net/oldforums/phpBBMain/index.php

For instance, the forums that were merged to the db under DAoC Duchy General - The Hitching post (shows 820 topics, 9169 posts) and DAoC recruits (shows 77 topics, 642 posts). Those numbers came across when the merge happened & are correct, yet when you click on the link it says "There are no posts in this forum. Click on the Post New Topic link on this page to post one."
I can see all of the merged topics, posts & posts text in my database, but for whatever reason they do not show.

Could anyone try to give me a hint to look for here as to why the topics, posts & posts_text are in the database but not showing up in the actual forum after the merge?

I appreciate your help.

Posted: Fri Jun 18, 2004 8:52 pm
by A_Jelly_Doughnut
For what it is worth, a member has supposedly improved BartVB's script, and posted it Here

This comes with no warranty from me...I'm just the messenger 8)

Posted: Sat Jun 19, 2004 4:46 pm
by TheGuyFromDowntown
How exactly do i use this :? ?

Posted: Wed Jun 30, 2004 6:07 am
by DianaRae
I got this working finally. But, I do have a question.

I "merged" the 2 databases. Then I needed to combine 2 forums into one. When I did that the dates are not in order. In fact they are exactly as they were when they were in different databases.

For instance:

post 1 - 6/29/2004>
post 2 - 6/15/2004>
post 3 - 2/01/2003><----the 3 above were from the original database

post 4 - 6/18/2004><----the 3 below are from the merged database
post 5 - 2/14/2004>
post 6 - 9/15/2003>


I have resynched & tried everything, but the dates will not go in date order.

any ideas as to what I might do to fix this?

Posted: Wed Jun 30, 2004 11:24 am
by Graham
This is a problem with the way phpBB orders posts (I see it a lot on conversions as well) - the fix is to alter one line of code in the viewforum.php file.

Instructions below

Find the following bit of code

Code: Select all

$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time 
 FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
 WHERE t.forum_id = $forum_id
  AND t.topic_poster = u.user_id
  AND p.post_id = t.topic_first_post_id
  AND p2.post_id = t.topic_last_post_id
  AND u2.user_id = p2.poster_id 
  AND t.topic_type <> " . POST_ANNOUNCE . " 
  $limit_topics_time
 ORDER BY t.topic_type DESC, t.topic_last_post_id DESC 
 LIMIT $start, ".$board_config['topics_per_page'];
Change it to

Code: Select all

$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time 
 FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
 WHERE t.forum_id = $forum_id
  AND t.topic_poster = u.user_id
  AND p.post_id = t.topic_first_post_id
  AND p2.post_id = t.topic_last_post_id
  AND u2.user_id = p2.poster_id 
  AND t.topic_type <> " . POST_ANNOUNCE . " 
  $limit_topics_time
 ORDER BY t.topic_type DESC, p2.post_time DESC 
 LIMIT $start, ".$board_config['topics_per_page'];

Posted: Wed Jun 30, 2004 3:19 pm
by DianaRae
Ah, you are a GENIOUS, Graham! Worked great!

Thanks so much for your time & help. :)

Posted: Wed Jul 21, 2004 1:39 pm
by bendude
Can some 1 help me to get this to work?

Posted: Wed Jul 21, 2004 3:14 pm
by DianaRae
bendude wrote: Can some 1 help me to get this to work?


What part isn't working?