Junction of Forum's

The 2.0.x discussion forum has been locked; this will remain read-only. The 3.0.x discussion forum has been renamed phpBB Discussion.
Locked
NEC4EVER
Registered User
Posts: 5
Joined: Sat Mar 20, 2004 2:06 am

Post by NEC4EVER » Tue Mar 23, 2004 11:20 am

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]

NEC4EVER
Registered User
Posts: 5
Joined: Sat Mar 20, 2004 2:06 am

Post by NEC4EVER » Tue Mar 23, 2004 12:25 pm

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

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Fri Mar 26, 2004 8:17 am

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

CMA
Registered User
Posts: 330
Joined: Mon Jun 02, 2003 4:15 pm
Location: Vancouver BC Canada
Contact:

Post by CMA » Thu Apr 15, 2004 4:35 am

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?

CMA
Registered User
Posts: 330
Joined: Mon Jun 02, 2003 4:15 pm
Location: Vancouver BC Canada
Contact:

Post by CMA » Thu Apr 15, 2004 3:13 pm

:? Can someone please help me?

CMA
Registered User
Posts: 330
Joined: Mon Jun 02, 2003 4:15 pm
Location: Vancouver BC Canada
Contact:

Post by CMA » Thu Apr 15, 2004 10:52 pm

is there no solution for that? :|

Snorii
Registered User
Posts: 3
Joined: Wed Apr 28, 2004 7:19 pm

Post by Snorii » Thu Apr 29, 2004 4:31 am

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

User avatar
DianaRae
Registered User
Posts: 163
Joined: Fri Mar 22, 2002 9:45 pm
Contact:

Post by DianaRae » Tue Jun 08, 2004 5:06 am

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.
Diana Rae
~I was blonde in another life..that explains a LOT of things~

User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Post by A_Jelly_Doughnut » Fri Jun 18, 2004 8:52 pm

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)
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish

TheGuyFromDowntown
Registered User
Posts: 15
Joined: Tue Jun 08, 2004 9:01 pm

Post by TheGuyFromDowntown » Sat Jun 19, 2004 4:46 pm

How exactly do i use this :? ?

User avatar
DianaRae
Registered User
Posts: 163
Joined: Fri Mar 22, 2002 9:45 pm
Contact:

Post by DianaRae » Wed Jun 30, 2004 6:07 am

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?
Diana Rae
~I was blonde in another life..that explains a LOT of things~

Graham
Former Team Member
Posts: 8462
Joined: Tue Mar 19, 2002 7:11 pm
Location: UK
Contact:

Post by Graham » Wed Jun 30, 2004 11:24 am

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'];
"So Long, and Thanks for All the Fish"

phpBB Useful Links: Knowledge Base | Userguide | Forum Search | MOD Database | Styles Database
My Links: Blog!

User avatar
DianaRae
Registered User
Posts: 163
Joined: Fri Mar 22, 2002 9:45 pm
Contact:

Post by DianaRae » Wed Jun 30, 2004 3:19 pm

Ah, you are a GENIOUS, Graham! Worked great!

Thanks so much for your time & help. :)
Diana Rae
~I was blonde in another life..that explains a LOT of things~

bendude
Registered User
Posts: 6
Joined: Wed Jul 21, 2004 12:38 pm

Post by bendude » Wed Jul 21, 2004 1:39 pm

Can some 1 help me to get this to work?

User avatar
DianaRae
Registered User
Posts: 163
Joined: Fri Mar 22, 2002 9:45 pm
Contact:

Post by DianaRae » Wed Jul 21, 2004 3:14 pm

bendude wrote: Can some 1 help me to get this to work?


What part isn't working?
Diana Rae
~I was blonde in another life..that explains a LOT of things~

Locked

Return to “2.0.x Discussion”