WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] "WordPress database error: [Duplicate entry '30280' for key 1]" - Help! (9 posts)

  1. simonread
    Member
    Posted 8 years ago #

    I checked my site this morning and was presented with a ton of errors, rendering the whole website pretty much useless. The main error seems to be:

    WordPress database error: [Duplicate entry '30280' for key 1]
    SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM wp_posts WHERE post_date < '2005-08-10 10:56:35' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC

    as well as these errors for my Poll:

    WordPress database error: [Duplicate entry '30280' for key 1]
    SELECT id, question, total_votes FROM wp_pollsq ORDER BY id DESC LIMIT 1

    WordPress database error: [Duplicate entry '30280' for key 1]
    SELECT aid, answers, votes FROM wp_pollsa WHERE qid = ORDER BY votes DESC

    I'm still pretty much a WordPress novice and I have no idea at all about what these errors means. I've used MySQLAdmin to repair the offending tables, but this hasn't helped. Any help would be hugely appreciated - thanks!

  2. skippy
    Member
    Posted 8 years ago #

    What happens if you de-activate your voting plugin?

  3. simonread
    Member
    Posted 8 years ago #

    If I turn off the plugin I get a blank page with this error on it:

    Fatal error: Call to undefined function: vote_poll() in /home/virtual/site79/fst/var/www/html/wp-content/themes/default/header.php on line 2

    I tried removing the snippet of PHP code which calls the poll, but strangely the above error still remains. However, if I remove "<?php vote_poll(); ?>" from the header then it goes back to the original page, with the original 'Wordpress database error' on. This is getting more confusing by the second :/

  4. simonread
    Member
    Posted 8 years ago #

    UPDATE:
    OK, I've removed everything to do with the Poll system from my template, and whilst there are no errors on the main index page the same errors appear whenever I try to access a Page (WordPress' definition of a page, not a html page that I have created myself). Could this have something to do with the way WordPress archives Pages? Anyone?

  5. simonread
    Member
    Posted 8 years ago #

    Anybody? I've seen this error mentioned before but nobody has a definite answer. Any help would be appreciated, thanks!

  6. simonread
    Member
    Posted 8 years ago #

    OK, I think I'm getting somewhere. Turns out it was a combination of ShortStats and the Poll plugin that was causing the errors; I've removed the offending PHP from the template until I can work out what was causing them. However, I still get this same error:

    Fatal error: Call to undefined function: vote_poll() in /home/virtual/site79/fst/var/www/html/wp-content/themes/default/header.php on line 2

    on any wordpress Page I try to access on my site. I'm pretty sure this has something to do with the way WordPress archives pages, but does ANYBODY have any way they can help me here?

  7. skippy
    Member
    Posted 8 years ago #

    Edit your header.php file and make sure that the vote_poll() function has been removed.

    WordPress doesn't archive pages unless you're using a caching plugin. WordPress dynamically generates pages for display when a user requests it.

  8. simonread
    Member
    Posted 8 years ago #

    Thanks for your help skippy. I had removed the code from my main header.php file, however I looked around my webspace and came across an older version of the file which still had the code in from when I had my WordPress set up within a subfolder. I didn't think it would affect it anymore but hey, it did. Removed it and everything seems to be working fine. Sorry for wasting your time, and thanks again for your help :)

  9. skippy
    Member
    Posted 8 years ago #

    No time wasted at all! I'm glad the problem was resolved (even if not necessarily fixed).

    To truly fix the problem, you might need to drop the tables used by your poll script and shortstats, and start over with both of them.

Topic Closed

This topic has been closed to new replies.

About this Topic