Forums / General Questions / 1062 Duplicate entry '0' for key 1

1062 Duplicate entry '0' for key 1

Locked

Views: 1,516

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
3 May 2010, 12:00 AM
#1
fredz avatar

fredz

New Zenner

Join Date:
Jan 2007
Posts:
66
Plugin Contributions:
0

1062 Duplicate entry '0' for key 1

I have just replaced my entire database with the original and now I have the followinf error when I go to the admin panel.

1062 Duplicate entry '0' for key 1
in:
[insert into zen_admin_activity_log (access_date, admin_id, page_accessed, page_parameters, ip_address) values (now(), '0', 'login.php ', '', '192.168.0.215')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

This error appears after I have entered the login details and will not dissapear at all.

The store itself functions as expected. just that I can no longer access the admin panel.

Any comments woulds be most helpfull

3 May 2010, 12:33 AM
#2
jtheed avatar

jtheed

Zen Follower

Join Date:
Apr 2008
Posts:
356
Plugin Contributions:
2

Re: 1062 Duplicate entry '0' for key 1

FredZ:

I have just replaced my entire database with the original and now I have the followinf error when I go to the admin panel.

1062 Duplicate entry '0' for key 1
in:
[insert into zen_admin_activity_log (access_date, admin_id, page_accessed, page_parameters, ip_address) values (now(), '0', 'login.php ', '', '192.168.0.215')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

This error appears after I have entered the login details and will not dissapear at all.

The store itself functions as expected. just that I can no longer access the admin panel.

Any comments woulds be most helpfull

The only thing that I can see that can't be duplicated is the log_id which is auto_incremented. If you have phpmyadmin to look at the database, check the admin_activity_log table and see what your last log_id is, then click on the operations tab and see what the AUTO_INCREMENT number is set to. If it is a number that already exists, set it one higher than the last one in the database.

3 May 2010, 12:47 AM
#3
fredz avatar

fredz

New Zenner

Join Date:
Jan 2007
Posts:
66
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1

I am guessing that the problem stems from me clearing the admin_activity_log table.

is there any way I can resolve that?

Regards

Fred

3 May 2010, 1:05 AM
#4
jtheed avatar

jtheed

Zen Follower

Join Date:
Apr 2008
Posts:
356
Plugin Contributions:
2

Re: 1062 Duplicate entry '0' for key 1

FredZ:

I am guessing that the problem stems from me clearing the admin_activity_log table.

is there any way I can resolve that?

Regards

Fred

You restored the database and then cleared the log or cleared the log and then restored the database?

Everything that you do in the admin pages are put into the activity log.

Do you have phpMyAdmin? If you do, click on the admin_activity_log and then click on empty. MAKE SURE you have admin_activity_log highlighted before you click on empty. You will get a warning when you do, but it will clear it out and set it up for the next entry number.
I just tried it and it worked fine.

If you only have access to the mysql program in say terminal mode, login to the mysql (requires knowledge of how to login with id. Change it to your database: use DATABASE_NAME;

then issue this command.

truncate admin_activity_log;

This will also clear the table of all entries.

3 May 2010, 1:32 AM
#5
fredz avatar

fredz

New Zenner

Join Date:
Jan 2007
Posts:
66
Plugin Contributions:
0

Re: 1062 Duplicate entry '0' for key 1

Well it seems I may have muffed things here, so I am just going to have to rebuild the entire site from scratch again. Probably a better thing regardless of the hours.

I can't get acces to the admin panel regardless of the database I import.

Thanks for the comments anyway.

Regards

Fred