MyBB Community Forums

Full Version: SQL 1062 Error duplicate Entry
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I have replaced the entry in users.php
but after it many users not imported
even me myself not imported from phpbb to mybb (admin)
is there any other solution ??
If they don't have a username, then yes they aren't imported. How can you have a user without a username? That is all this modification does. It does not get rid of valid users.
But also i am unable to find this in users.php your given complete text in which is in this quote ,
could you provide me the complete corrected file /merge/boards/phpbb3/users.php

function import()

    {

        global $import_session;

        

        // Get members

        $query = $this->old_db->simple_select("users", "*", "user_id > 0 AND username != 'Anonymous' AND group_id != 6", array('limit_start' => $this->trackers['start_users'], 'limit' => $import_session['users_per_screen']));

        while($user = $this->old_db->fetch_array($query))

        {

            $this->insert($user);

        }

    } 

and

function fetch_total()

    {

        global $import_session;

        

        // Get number of members

        if(!isset($import_session['total_users']))

        {

            $query = $this->old_db->simple_select("users", "COUNT(*) as count", "user_id > 0 AND username != 'Anonymous' AND group_id != 6");

            $import_session['total_users'] = $this->old_db->fetch_field($query, 'count');

            $this->old_db->free_result($query);

        }

        

        return $import_session['total_users'];

    } 
What version of Merge System? Latest I suppose?

But really, this change here is VERY minor and you should be able to find those 2 spots. They're the only 2 spots with sql queries even remotely like that.
I am using latest version of merge 1.6.1
I needs this edited file,
I am doing a test run conversion from phpbb3 to myBB 1605 using myBB merge 1602.

I am receiving this same error but in a different circumstance; I get it for usernames with specialcharacters, although the characters themselves don't seem to be translating correctly.

For example, while running the Users part of the merge I get the following error:

1062 - Duplicate entry 'Fländer' for key 2

When I used the e-mail address to look up the user on the phpbb board, I find that his username there is 'Fländer'.

Doing a select on 'Fländer' in the phpbb MySQL, there is only one of him. There are none of that name in the myBB database, but there is already a 'Fländer'.

At the moment I have just been deleting the first version of 'Fländer' and resuming the user merge, and except for the fact that the username is 'Fländer' this seems to be working. But I have an awful lot of users with special characters in their names.

I suspect this may also be related to the UTF-8 issue mentioned here: http://community.mybb.com/thread-87205.html
Have you verified you're setting the proper encoding in the dropdown to match the phpBB3 db encoding? And that the option to convert to UTF8 is checked?

Either way, even if it is malfing up the username, it should never be inserting it twice. Which means you probably have another user who's name is malfing up to the same thing and causing the issue.
(2011-11-28, 05:08 AM)Dylan M. Wrote: [ -> ]Have you verified you're setting the proper encoding in the dropdown to match the phpBB3 db encoding? And that the option to convert to UTF8 is checked?

That was the first thing I double-checked.* The option to convert to UTF-8 mentions messages specifically, so I wasn't certain if it related to my problem with usernames, but I double-checked it regardless. Maybe I am looking at the wrong info below?

Query: SHOW CREATE TABLE phpbb_users;
Result:
'CREATE TABLE phpbb_users (
[...]
username varchar(255) collate utf8_bin NOT NULL default '''',
username_clean varchar(255) collate utf8_bin NOT NULL default '''',
[...]
) ENGINE=MyISAM AUTO_INCREMENT=5169 DEFAULT CHARSET=utf8 COLLATE=utf8_bin'


(2011-11-28, 05:08 AM)Dylan M. Wrote: [ -> ]Either way, even if it is malfing up the username, it should never be inserting it twice. Which means you probably have another user who's name is malfing up to the same thing and causing the issue.

That was the second thing I double-checked. Smile Again, maybe I am looking at the wrong info, but the following query gives me only one result:

Query: SELECT username FROM phpbb_users where username like 'Fl%nder';
Result: 'Fländer'

*As an aside, whenever I come back to the MyBB Merge System - phpBB 3 Database Configuration page, the values have reset to UTF-8 Unicode and Yes, respectively. I don't know if those are the default or if it's because that's what I selected the first time I came through that page, but playing with the values subsequently doesn't change the display when I return to the page afterwards.
Ok, but what collation is your phpBB database?
I'm not entirely certain what you mean by the collation of my phpBB database. If I'm reading this correctly, the default encoding for tables latin1:

Query: SHOW CREATE DATABASE wowpetopia_forums;

Result: 'CREATE DATABASE wowpetopia_forums /*!40100 DEFAULT CHARACTER SET latin1 */'

But all of the individual phpBB tables override that with: DEFAULT CHARSET=utf8 COLLATE=utf8_bin in their CREATEs.
Pages: 1 2 3