[solved] MySQL error - duplicate entry

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
stopsatgreen
Power Poster
Power Poster
Posts: 322
Joined: Sat Feb 04, 2006 1:24 am
Location: London, England

[solved] MySQL error - duplicate entry

Post by stopsatgreen »

On Friday my WAMP server crashed and corrupted the MySQL files. I reinstalled all the files to get it running again and restored backup data, which seemed to do the trick; the site is back online and functioning as normal - except for one key problem. When I try to submit News stories I get the error:
Duplicate entry '0' for key 1
If I'm correct, I think this means the News module is trying to restart the ID numbering from 0, which is conflicting with existing stories. How can I stop this conflict?

I found that the news_id field in cms_module_news and set it to auto increment and that seems to have done the trick. Not sure why it stopped before.

Update: Reopening this as I have another problem. I can't assign multiple permissions on the Group Permissions page; when I do, I get the error:
FATAL: Duplicate entry '0' for key 1
This one can't be resolved by adding an auto increment. I've compared the MySQL settings with a live, functioning one, and they seem to be identical. Anyone help me out on this?
Last edited by stopsatgreen on Tue Sep 09, 2008 8:33 pm, edited 1 time in total.
stopsatgreen
Power Poster
Power Poster
Posts: 322
Joined: Sat Feb 04, 2006 1:24 am
Location: London, England

Re: MySQL error - duplicate entry

Post by stopsatgreen »

I've just noticed that my restored database doesn't have the module_xx_seq tables* any more - is this causing the error? Can I restore them?

* As seen in this post: http://forum.cmsmadesimple.org/index.ph ... 131.0.html
NaN

Re: MySQL error - duplicate entry

Post by NaN »

If you know what Module needs sequence tables you just can create it by yourself.
But you need to know what value to insert there.
In the news module you just need to know the highest article and category id.
Insert in ..._seq table the highest id + 1.

It would be easier to reinstall the modules, update your database and adapt the values of the sequence tables cause you don't know what module needs what sequence tables.
stopsatgreen
Power Poster
Power Poster
Posts: 322
Joined: Sat Feb 04, 2006 1:24 am
Location: London, England

Re: MySQL error - duplicate entry

Post by stopsatgreen »

Not being a MySQL wizard, I created a new DB and installed a fresh copy of CMSMS into it, dropped all the tables that existed in my original DB, then transferred the new DB in; seems to have done the trick. Thanks.
Post Reply

Return to “Developers Discussion”