Menu

Fatal Error While Setting Preference

Help
2006-05-17
2012-10-11
  • Wang Xiaoyun

    Wang Xiaoyun - 2006-05-17

    When I want to change my admin preference, the following error appears. What does that mean?

    Fatal Error:

    lib/WikiDB/adodb/adodb-errorhandler.inc.php (In template 'body' < 'html'):76: Error: mysql error: [1062: Duplicate entry 'admin' for key 1] in EXECUTE("INSERT INTO pref (prefs,userid) VALUES ('a:2:{s:6:\&quot;userid\&quot;;s:5:\&quot;admin\&quot;;s:5:\&quot;email\&quot;;s:17:\&quot;my@email.com\&quot;;}','admin')")

    *
    

    lib/WikiUserNew.php (In template 'body' < 'html'):1725: Notice: fputs(): send of 6 bytes failed with errno=104 Connection reset by peer

    Fatal PhpWiki Error

    lib/WikiDB/adodb/adodb-errorhandler.inc.php (In template 'body' < 'html'):76: Error: mysql error: [1062: Duplicate entry 'admin' for key 1] in EXECUTE("INSERT INTO pref (prefs,userid) VALUES ('a:2:{s:6:\&quot;userid\&quot;;s:5:\&quot;admin\&quot;;s:5:\&quot;email\&quot;;s:17:\&quot;my@email.com\&quot;;}','admin')")

    Thanks in advance.

     
    • Reini Urban

      Reini Urban - 2006-05-17

      This means that you have a wrong SQL query which detects if a user exists.
      This query which fails tries to add a new user, which already exists.

      DBAUTH_PREF_SELECT
      "SELECT prefs FROM pref WHERE userid='$userid'"

      If a user exists it will use DBAUTH_PREF_UPDATE, not
      DBAUTH_PREF_INSERT

       
      • Vivek Mittal

        Vivek Mittal - 2007-10-13

        Hi,

        I just installed the latest version of phpwiki and am also getting this error when I try to change any preference. I am using it with MySQL and the sql statement in config.ini looks ok to me.

        The relevant snippet from my config.ini is as follows.

        DBAUTH_PREF_SELECT = "SELECT prefs FROM pref WHERE userid='$userid'"
        ; Update the user's preferences
        DBAUTH_PREF_UPDATE = "UPDATE pref SET prefs='$pref_blob' WHERE userid='$userid'"
        ;DBAUTH_PREF_INSERT = "INSERT INTO pref (userid,prefs) VALUES ('$userid','$pref_blob')"

        The exact error message is as follows:

        lib/WikiDB/backend/PearDB.php (In template 'body' < 'html'):1059 Error: wikidb_backend_peardb_mysql: fatal database error

        * DB Error: already exists
        * (INSERT INTO pref (prefs,userid) VALUES ('a:3:{s:6:\&quot;userid\&quot;;s:11:\&quot;VivekMittal\&quot;;s:5:\&quot;email\&quot;;s:23:\&quot;apna@apna.org\&quot;;s:5:\&quot;theme\&quot;;s:9:\&quot;Wordpress\&quot;;}','VivekMittal') [nativecode=1062 ** Duplicate entry 'VivekMittal' for key 1])
        

        Can you provide some more suggestion on what I need to look for to solve this.

        Thank you.
        Vivek

         
    • Wang Xiaoyun

      Wang Xiaoyun - 2006-05-18

      Thanks for the reply.

      So what should I do to avoid the error? I just logged in with my administrator account set in configure.ini and tried to add an email address to it.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.