We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12328
    • 9 Posts
    Hey,
    I have been working on a website locally on my computer and recently uped it to my web server. I updated the database connection, and for the most part everything seems to be working great. Except I keep getting a parse error when in the manager portion of the website. I have searched the forum but couldn’t find anything that matched. What is causing this?

    Here is the error:
    ------------------------------------------------------
    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - Duplicate entry ’0’ for key 1 »
    SQL: INSERT INTO `prowheel_modx`.modx_manager_log(timestamp, internalKey, username, action, itemid, itemname, message) VALUES(’1158684211’, ’1’, ’prowheel’, ’76’, ’-’, ’Pro-Wheel’, ’Reource management’)
    [Copy SQL to ClipBoard]

    Parser timing
    MySQL: 0.0238 s s (0 Requests)
    PHP: 1158684211.6513 s s
    Total: 1158684211.6751 s s
    ------------------------------------------------------

    Web Server:
    -------------------------------
    PHP 4.4.1
    MySQL 4.0.16
    Apache 1.3.33
    FreeBSD 4.11

    Browser/OS:
    -------------------------------
    IE 6.0.29
    Win XP SP2

    - Brandon
      • 25663 MODX Staff
      • 12,272 Posts
      Try turning off the built in site stats (they’re gone in 095). They cause lots of problems. You’ll also need to truncate those stats-related tables, too.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Looks like the "id" field didn’t get auto_increment set properly. Use your phpMyAdmin to add it.

        @rthrash, Is the manager log turned off when you turn of visitor logging? I didn’t think it did.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 12328
          • 9 Posts
          You were right. I researched and found out there is a bug were mysqldump omits ’auto_increment’ in MySQL4.0 compatibility mode. I just wrote a little script to fix the affected tables and everything works great now. Thanks for the help!

          If anyone else has this problem here is the script I used.
          -------------------------------------------------------------
          #############################################################################
          # The purpose of this script is to fix an import of a ModX database
          # dumped from mysqldump in MySQL4.0 compatibility mode with the auto_increment
          # bug, http://bugs.mysql.com/bug.php?id=14515.
          #
          # Run this script after doing the import.
          #############################################################################
          ALTER TABLE `modx_categories` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_documentgroup_names` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_document_groups` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_event_log` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_manager_log` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_manager_users` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_membergroup_access` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_membergroup_names` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_member_groups` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_content` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_htmlsnippets` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_keywords` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_metatags` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_modules` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_module_access` CHANGE `id` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_module_depobj` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_plugins` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_snippets` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_templates` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_tmplvars` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_tmplvar_access` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_site_tmplvar_contentvalues` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_system_eventnames` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_user_attributes` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_user_messages` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_user_roles` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_webgroup_access` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_webgroup_names` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_web_groups` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_web_users` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ALTER TABLE `modx_web_user_attributes` CHANGE `id` `id` INT( 10 ) NOT NULL AUTO_INCREMENT;
          ---------------------------------------------------------------

          - Brandon
            • 25663 MODX Staff
            • 12,272 Posts
            This might make for an interesting part of a "restore" component to go with the existing exporter... smiley
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me