Title: SQL insert error
Last modified: November 30, 2020

---

# SQL insert error

 *  Resolved [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/)
 * (@swissspaceboy)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/)
 * Hi Bill,
 * I got this error log reported while inserting a record in the table “sbb_visitorslog”.
   I never saw that before. I think that the weird user agent is causing problems.
   Maybe some sanitizing will help to de-infect the query 🙂
 * Please check.
    Thanks. Didier.
 * [30-Nov-2020 16:01:28 UTC] WordPress database error You have an error in your
   SQL syntax; check the manual that corresponds to your MariaDB server version 
   for the right syntax to use near ‘mozilla/5.0 (compatible; seekport crawler; 
   [http://seekport.com/&#8221](http://seekport.com/&#8221);)’ at line 12 for query
   INSERT INTO ctn_sbb_visitorslog (reason,ip, response, human, bot, method, url,
   referer, access, ua)
    VALUES ( ‘Blocked by Name’, ‘95.217.228.120’, ‘403’, ‘Maybe’,‘?’,‘
   GET’, ‘/coaching-recherche-emploi-suisse-romande/’, ”, ‘Denied’, ”mozilla/5.0(
   compatible; seekport crawler; [http://seekport.com/&#8221](http://seekport.com/&#8221);)
   made by require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘
   wp-config.php’), require_once(‘wp-settings.php’), include_once(‘/plugins/stopbadbots/
   stopbadbots.php’), stopbadbots_response, stopbadbots_record_log
    -  This topic was modified 5 years, 6 months ago by [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/).

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

 *  Plugin Author [sminozzi](https://wordpress.org/support/users/sminozzi/)
 * (@sminozzi)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13729154)
 * Hi Didier,
 * This bot (seekport) was blocked and received error 403. They was unable to scan
   your site.
 * The query to include on visitors log fail because the user agent string returned
   by your server PHP. We sanitize it before to write.
 * We have no problem with it in our server but we are unable to duplicate it because
   WordPress forum system replace the characters.
 * Try to use PHP version 7.3 or newer.
 * Don’t worry about.
 * Cheers,
    Bill
 *  Thread Starter [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/)
 * (@swissspaceboy)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13729255)
 * Hi,
 * I am using PHP 7.4. Try the insert below. No escaping seems to be done:
 *     ```
       INSERT INTO ctn_sbb_visitorslog (reason,ip, response, human, bot, method, url, referer, access, ua)
               VALUES (
            'Blocked by Name',            
            '95.217.228.120',
            '403',
            'Maybe',
            '?',
            'GET',
            '/coaching-recherche-emploi-suisse-romande/',
            '',
            'Denied',
            ''mozilla/5.0 (compatible; seekport crawler; http://seekport.com/'')
       ```
   
 *  Plugin Author [sminozzi](https://wordpress.org/support/users/sminozzi/)
 * (@sminozzi)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13729386)
 * If that happens just once, don’t worry about!
 *  Thread Starter [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/)
 * (@swissspaceboy)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13729510)
 * oh I am not worried. I know the impact. I am working >20 years in software maintenance,
   so I prefer to log all bugs, so that the software quality can improve. If not
   logged, no one will fix for sure.
 * 🙂
 * Didier.
 *  Plugin Author [sminozzi](https://wordpress.org/support/users/sminozzi/)
 * (@sminozzi)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13729532)
 * I began to work with software in 1977. No windows, No PC in that year.
    We create
   this free plugin to log errors: [https://wordpress.org/plugins/wptools/](https://wordpress.org/plugins/wptools/)
   I installed it in our sites.
 *  Thread Starter [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/)
 * (@swissspaceboy)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13756167)
 * New SQL error with funny user agent
 * [07-Dec-2020 10:27:51 UTC] Erreur de la base de données WordPress You have an
   error in your SQL syntax; check the manual that corresponds to your MariaDB server
   version for the right syntax to use near ‘t waste my time! extension/1.0 (skavans.
   dont-waste-my-time.extension; build:2…’ at line 12 pour la requête INSERT INTO
   ctn_sbb_visitorslog (reason,ip, response, human, bot, method, url, referer, access,
   ua)
    VALUES ( ”, ‘178.39.158.128’, ‘200’, ‘Human’, ‘0’, ‘GET’, ‘/’, ”, ‘OK’, ‘
   don’t waste my time! extension/1.0 (skavans.dont-waste-my-time.extension; build:
   2; macos 10.15.7) alamofire/5.0.4’)
 * faite par require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.
   php’), do_action(‘template_redirect’), WP_Hook->do_action, WP_Hook->apply_filters,
   stopbadbots_record_log
 *  Plugin Author [sminozzi](https://wordpress.org/support/users/sminozzi/)
 * (@sminozzi)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13758379)
 * Hi Didier,
 * I put a replace command before the query to replace ‘ with \’
 * I will test and let you know today later if works fine and how to fix it on your
   server.
 * Cheers,
 * Bill
 *  Thread Starter [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/)
 * (@swissspaceboy)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13761163)
 * Thanks Bill!
 * What a crap is Internet. You can decide what user agent you want to use for your
   requests. Who allowed that???
 * All that spoofing should be technically impossible.
 * Didier.
 *  Plugin Author [sminozzi](https://wordpress.org/support/users/sminozzi/)
 * (@sminozzi)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13761213)
 * Hi Didier,
 * Yes, it is true.
 * You can download the new file (functions.php) here:
    [http://stopbadbots.com/functions.zip](http://stopbadbots.com/functions.zip)
 * Just unzip and upload it.
    wp-content/plugins/stopbadbots/functions
 * Or just wait. I will change on the next version.
 * Cheers,
    Bill
 *  Thread Starter [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/)
 * (@swissspaceboy)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13772636)
 * Hello,
 * For your reference, two errors yesterday with crappy user agents
 *     ```
       ''mozilla/5.0 (compatible; seekport crawler; http://seekport.com/''
       ''mozilla/5.0 (compatible; seekport crawler; http://seekport.com/''
       ```
   
 * So always this seekport crawler with quotes in the UA. What a stupid idea. He/
   She missed out some coding classes at school 🙂
 * Didier.
    -  This reply was modified 5 years, 6 months ago by [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/).
    -  This reply was modified 5 years, 6 months ago by [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/).
 *  Plugin Author [sminozzi](https://wordpress.org/support/users/sminozzi/)
 * (@sminozzi)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13772789)
 * Hi Didier,
 * Today I uploaded the new plugin version and fixed that.
    Just make upgrade. Thanks
   for let me know.
 * Cheers,
    Bill
 *  Thread Starter [swissspaceboy](https://wordpress.org/support/users/swissspaceboy/)
 * (@swissspaceboy)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/sql-insert-error/#post-13843120)
 * Seems fixed now. Thanks.
 *  [infostrides](https://wordpress.org/support/users/infostrides/)
 * (@infostrides)
 * [5 years ago](https://wordpress.org/support/topic/sql-insert-error/#post-14462340)
 * Apologies to bump this post again. I am having a similar issue with my website.
   About 4 million rows of errors in error log and made my website unaccessible.
   Some examples below. What can I do?
 *     ```
       [20-May-2021 11:10:38 UTC] WordPress database error Duplicate entry '8388607' for key 'id' for query INSERT INTO wp_sbb_visitorslog (reason,ip, response, human, bot, method, url, referer, access, ua)
               VALUES (
            '',            
            '136.244.99.40',
            '200',
            'Maybe',
            '?',
            'GET',
            '/41-people-leave-this-world-in-313-road-accidents-in-borno-frsc/',
            '',
            'OK',
            'mozilla/5.0 (windows nt 10.0; win64; x64; rv:82.0) gecko/20100101 firefox/82.0') made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), WP_Hook->do_action, WP_Hook->apply_filters, stopbadbots_record_log
       [20-May-2021 11:10:38 UTC] WordPress database error Duplicate entry '8388607' for key 'id' for query INSERT INTO wp_sbb_visitorslog (reason,ip, response, human, bot, method, url, referer, access, ua)
               VALUES (
            '',            
            '78.135.112.74',
            '200',
            'Maybe',
            '?',
            'GET',
            '/ogun-nlc-happy-over-amosuns-re-election/',
            '',
            'OK',
            'googlebot/2.1; +http://www.google.com/bot.html') made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), WP_Hook->do_action, WP_Hook->apply_filters, stopbadbots_record_log
       [20-May-2021 11:10:39 UTC] WordPress database error Duplicate entry '8388607' for key 'id' for query INSERT INTO wp_sbb_visitorslog (reason,ip, response, human, bot, method, url, referer, access, ua)
               VALUES (
            'Blocked by Name',            
            '114.119.140.103',
            '403',
            'Maybe',
            '?',
            'GET',
            '/british-comedian-released-in-sex-abuse-probe/?amp',
            '',
            'Denied',
            'mozilla/5.0 (linux; android 7.0;) applewebkit/537.36 (khtml, like gecko) mobile safari/537.36 (compatible; petalbot;+https://webmaster.petalsearch.com/site/petalbot)') made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/stopbadbots/stopbadbots.php'), stopbadbots_response, stopbadbots_record_log
       [20-May-2021 11:10:40 UTC] WordPress database error Duplicate entry '8388607' for key 'id' for query INSERT INTO wp_sbb_visitorslog (reason,ip, response, human, bot, method, url, referer, access, ua)
               VALUES (
            'HTTP Tools',            
            '185.220.101.194',
            '403',
            'Maybe',
            '?',
            'GET',
            '/41-people-leave-this-world-in-313-road-accidents-in-borno-frsc/',
            '',
            'Denied',
            'kurl/7.58.0') made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/stopbadbots/stopbadbots.php'), stopbadbots_response, stopbadbots_record_log
       [20-May-2021 11:10:40 UTC] WordPress database error Duplicate entry '8388607' for key 'id' for query INSERT INTO wp_sbb_visitorslog (reason,ip, response, human, bot, method, url, referer, access, ua)
               VALUES (
            'HTTP Tools',            
            '78.135.112.74',
            '403',
            'Maybe',
            '?',
            'GET',
            '/ogun-nlc-happy-over-amosuns-re-election/',
            '',
            'Denied',
            'mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, like gecko) chrome/42.0.2311.135 safari/537.36') made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/stopbadbots/stopbadbots.php'), stopbadbots_response, stopbadbots_record_log
       ```
   
 *  Plugin Author [sminozzi](https://wordpress.org/support/users/sminozzi/)
 * (@sminozzi)
 * [5 years ago](https://wordpress.org/support/topic/sql-insert-error/#post-14462399)
 * Hi,
 * Please, check if you are running the plugin last version.
 * The error is:
    _Duplicate entry ‘8388607’ for key ‘id’_ That means the system
   is trying insert twice the same query.
 * Please, check with phpmyadmin if this table is not damaged:
    wp_sbb_visitorslog
 * You have around 9.000.000 records in this table and **maybe your sql server is
   overloaded.**
 * in Dashboard => Stop Bad Bots => General Settings
    How long keep the visitors
   log file? Check if you have **1 day selected** (no more).
 * If you find old records in that table, maybe your **Cron Jobs** it not working
   fine. You can find free plugins on word press to inspect cron jobs.
 * Check if your server processor is not overloaded. You can control it with this
   free plugin:
    [https://wordpress.org/plugins/wptools/](https://wordpress.org/plugins/wptools/)
 * Check also your memory available, on stop bad bots dashboard.
 * Please, let me know if you are able to fix it.
    Cheers, Bill
 *  Plugin Author [sminozzi](https://wordpress.org/support/users/sminozzi/)
 * (@sminozzi)
 * [5 years ago](https://wordpress.org/support/topic/sql-insert-error/#post-14462613)
 * Please, read my previous post.
    I forgot to say. The Id is not supplied for us.
   Is your database server job. Just look the query. Then, is not plugin fail.

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

The topic ‘SQL insert error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/stopbadbots_f0f0f0.svg)
 * [Block Bad Bots and Stop Bad Bots Crawlers and Spiders and Anti Spam Protection](https://wordpress.org/plugins/stopbadbots/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/stopbadbots/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/stopbadbots/)
 * [Active Topics](https://wordpress.org/support/plugin/stopbadbots/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/stopbadbots/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/stopbadbots/reviews/)

 * 15 replies
 * 3 participants
 * Last reply from: [sminozzi](https://wordpress.org/support/users/sminozzi/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/sql-insert-error/#post-14462613)
 * Status: resolved