Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,472
    Plugin Contributions
    88

    Default Error: Duplicate entry in admin_activity_log

    I've been asked to look at an installation (Zen Cart v1.5.1, running on Windows Server 2008 using PHP 5.3.28) where the admin-access is not working.

    There's a log generated each time an admin attempts to log in:
    Code:
    PHP Fatal error:  1062:Duplicate entry '236817' for key 'PRIMARY' :: insert into admin_activity_log (access_date, admin_id, page_accessed, page_parameters, ip_address, gzpost, flagged, attention) values (now(), '0', 'login.php ', 'camefrom=index.php&', '<edited>', '', '0', '')
    This is coming from /admin/includes/init_includes/init_admin_history.php, line 57, and it's always that duplicate entry 236817. How could the database get so that an auto-increment field won't increment?

    I'm currently waiting to get access credentials for the server to see what I can see. Any ideas would be much appreciated.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Error: Duplicate entry in admin_activity_log

    Is this a clean v151 or an upgraded one?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,472
    Plugin Contributions
    88

    Default Re: Error: Duplicate entry in admin_activity_log

    It's a highly customized original-install Zen Cart 1.5.1.

  4. #4
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Error: Duplicate entry in admin_activity_log

    Quote Originally Posted by lat9 View Post
    How could the database get so that an auto-increment field won't increment?
    One possibility (speculation) is if the DB somehow managed to have a record inserted with a higher value than the current auto increment value. All will be fine until the auto-increment value 'catches up' to the erroneous entry, at which time the duplicate entry error will occur and further increments could fail.

    I'm probably not going to be suggesting anything new to you here, but the 1st thing I'd be doing is searching the DB for the '236817' entry and see how it 'fits' with all the other auto-increment values.

    I further suspect that simply dropping and recreating the table may be the easiest of solutions, although doing this wan't reveal the actual cause (and I'm actually quite curious about this one).

    Cheers
    RodG

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,472
    Plugin Contributions
    88

    Default Re: Error: Duplicate entry in admin_activity_log

    Thanks, RodG! After the MySQL server was restarted, the issue "disappeared" and I haven't been back to the site to check that out ... but I will.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Error: Duplicate entry in admin_activity_log

    Quote Originally Posted by lat9 View Post
    I've been asked to look at an installation (Zen Cart v1.5.1, running on Windows Server 2008 using PHP 5.3.28) where the admin-access is not working.

    There's a log generated each time an admin attempts to log in:
    Code:
    PHP Fatal error:  1062:Duplicate entry '236817' for key 'PRIMARY' :: insert into admin_activity_log (access_date, admin_id, page_accessed, page_parameters, ip_address, gzpost, flagged, attention) values (now(), '0', 'login.php ', 'camefrom=index.php&', '<edited>', '', '0', '')
    This is coming from /admin/includes/init_includes/init_admin_history.php, line 57, and it's always that duplicate entry 236817. How could the database get so that an auto-increment field won't increment?
    In v1.5.1 the primary key is on log_id which is defined as a "bigint" datatype, capable of accepting values as high as 9223372036854775807. Ref: http://dev.mysql.com/doc/refman/5.7/...ger-types.html

    And, since the INSERT statement you quoted doesn't specify log_id, the log_id is being assigned by auto-increment. So, as you implied, the first problem is that the autoincrement is producing a duplicate. That in itself implies a bug at the database level.
    Second, since the "duplicate" is on a non-remarkable 6-digit value (non-remarkable as in it doesn't correlate to any of the "limits" imposed by the other integer data-type sizes that MySQL offers), that suggests either that there is general corruption in the database table (try a REPAIR TABLE?) or perhaps the table schema has been altered in some bizarre way (compare schema vs original install sql).


    You said a server restart helped. That might have triggered some internal table-repair routine. I might still suggest that you perform a repair on all the tables to address possible other corruption issues that might have been caused by some abrupt server crash/restart that happened before you were brought in to investigate.
    And make a full db backup for the site-owner to archive "just in case", as there might be other reliability concerns that this situation might be flagging, and now is a good time to take some protective measures.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,472
    Plugin Contributions
    88

    Default Re: Error: Duplicate entry in admin_activity_log

    Thanks for the detailed update, DrByte. You and RodG have confirmed for me the direction(s) in which I'll head next!

  8. #8
    Join Date
    Jul 2017
    Location
    nyc
    Posts
    1
    Plugin Contributions
    0

    Default Re: Error: Duplicate entry in admin_activity_log

    ALTER TABLE `admin_activity_log` CHANGE `log_id` `log_id` BIGINT(15) NOT NULL AUTO_INCREMENT;

 

 

Similar Threads

  1. PHP Fatal error: 1062 Duplicate entry Error, cannot fix table
    By RoboPhung in forum General Questions
    Replies: 5
    Last Post: 10 Apr 2013, 09:03 PM
  2. Duplicate entry error
    By frazeks in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 31 Jul 2009, 06:48 PM
  3. Error 1062 Duplicate Entry
    By Betsysue in forum Upgrading from 1.3.x to 1.3.9
    Replies: 1
    Last Post: 31 May 2008, 04:12 PM
  4. Duplicate entry error
    By seanscully in forum General Questions
    Replies: 6
    Last Post: 22 Feb 2007, 04:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR