Title: Database error Duplicate entry
Last modified: August 21, 2016

---

# Database error Duplicate entry

 *  Resolved [Mark Ratledge](https://wordpress.org/support/users/songdogtech/)
 * (@songdogtech)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/database-error-duplicate-entry/)
 * FYI, getting lots of these php errors:
 * > WordPress database error Duplicate entry ‘625524330’ for key ‘PRIMARY’ for 
   > query INSERT INTO wp_avhfdas_ipcache (ip, spam, added, lastseen) VALUES (‘625524330’,
   > 0, ‘2013-05-13 09:55:14’, ‘2013-05-13 09:55:14’) made by require(‘wp-blog-header.
   > php’), require_once( […]
 * [http://wordpress.org/extend/plugins/avh-first-defense-against-spam/](http://wordpress.org/extend/plugins/avh-first-defense-against-spam/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [petervanderdoes](https://wordpress.org/support/users/petervanderdoes/)
 * (@petervanderdoes)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/database-error-duplicate-entry/#post-3749295)
 * This happens when the spammers hammer your site. Sometimes they try to post withing
   one second, the first write to the database hasn’t yet completed when the 2nd
   write is performed.
 *  [petesky](https://wordpress.org/support/users/petesky/)
 * (@petesky)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/database-error-duplicate-entry/#post-3749508)
 * Hello !
 * To avoid this error (while being hammered) 🙂
 * $result = $wpdb->query($wpdb->prepare(“INSERT **DELAYED** INTO $wpdb->avhfdasipcache(
   ip, spam, added, lastseen) VALUES (%s, %d, %s, %s)”, $ip, $spam, $date, $date)**
   ON DUPLICATE KEY UPDATE** ip=’$ip’,spam=’$spam’,… );
 * [http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html](http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html)
 * Maybe you can update the files , thank you
 *  Thread Starter [Mark Ratledge](https://wordpress.org/support/users/songdogtech/)
 * (@songdogtech)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/database-error-duplicate-entry/#post-3749511)
 * petesky, this would be good to try; what’s the complete code chunk? I tried to
   adapt what you posted but got errors.
 *  Plugin Author [petervanderdoes](https://wordpress.org/support/users/petervanderdoes/)
 * (@petervanderdoes)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/database-error-duplicate-entry/#post-3749512)
 * I just released v3.6.1 with the above fix.
 *  Thread Starter [Mark Ratledge](https://wordpress.org/support/users/songdogtech/)
 * (@songdogtech)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/database-error-duplicate-entry/#post-3749513)
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Database error Duplicate entry’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/avh-first-defense-against-spam.svg)
 * [AVH First Defense Against Spam](https://wordpress.org/plugins/avh-first-defense-against-spam/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/avh-first-defense-against-spam/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/avh-first-defense-against-spam/)
 * [Active Topics](https://wordpress.org/support/plugin/avh-first-defense-against-spam/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/avh-first-defense-against-spam/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/avh-first-defense-against-spam/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Mark Ratledge](https://wordpress.org/support/users/songdogtech/)
 * Last activity: [12 years, 12 months ago](https://wordpress.org/support/topic/database-error-duplicate-entry/#post-3749513)
 * Status: resolved