Title: Database issues
Last modified: August 22, 2016

---

# Database issues

 *  [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * (@gmariani405)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/database-issues-9/)
 * Getting these issues from your plugin when saving data in the database.
 *  VALUES (‘201’, INET_ATON(‘132.3.49.82’), ‘Mozilla/4.0 (compatible; MSIE 8.0;
   Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .
   NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; Tablet PC 2.0)’, ‘2015-01-
   06’, ‘us’, ‘[http://hdel.com/ultimate/&#8217](http://hdel.com/ultimate/&#8217);)
   made by require(‘wp-blog-header.php’), wp, WP->main, do_action_ref_array, call_user_func_array,
   CountPerDay->count, CountPerDayCore->mysqlQuery
    [06-Jan-2015 19:42:16 UTC] WordPress
   database error Data too long for column ‘client’ at row 1 for query INSERT INTO
   wp_cpd_counter (page, ip, client, date, country, referer)
 *  VALUES (‘201’, INET_ATON(‘132.3.49.79’), ‘Mozilla/4.0 (compatible; MSIE 8.0;
   Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .
   NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; Tablet PC 2.0)’, ‘2015-01-
   06’, ‘us’, ‘[http://hdel.com/ultimate/&#8217](http://hdel.com/ultimate/&#8217);)
   made by require(‘wp-blog-header.php’), wp, WP->main, do_action_ref_array, call_user_func_array,
   CountPerDay->count, CountPerDayCore->mysqlQuery
    [06-Jan-2015 22:24:24 UTC] WordPress
   database error Incorrect integer value: ” for column ‘page’ at row 1 for query
   INSERT INTO wp_cpd_counter (page, ip, client, date, country, referer)
 * In the database, client was set to only 150 characters, you might want to bump
   this up….a lot. I also had to do the same with the referer column.
 * [https://wordpress.org/plugins/count-per-day/](https://wordpress.org/plugins/count-per-day/)

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

 *  Plugin Author [Tom Braider](https://wordpress.org/support/users/tom-braider/)
 * (@tom-braider)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/database-issues-9/#post-5650646)
 * I limit the columns to reduce the size of the database. Most users doesn’t own
   unlimited server capacity.
    MySql automatically ‘cuts’ the data and can read ‘
   201’ as 201. Btw. WordPress formats this query.
 *  Thread Starter [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * (@gmariani405)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/database-issues-9/#post-5650648)
 * Hmm.. that’s the issue then. It’s not automatically ‘cutting’ it, and the string
   isn’t being converted to an integer. Maybe an issue with MySQL then.. Started
   getting this error late december.
 *  Thread Starter [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * (@gmariani405)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/database-issues-9/#post-5650687)
 * Tom,
 * I’ve figured out the issue and I think you’ll need to make an update to your 
   plugin regardless. The issue is that you are assuming that MySQL is going to 
   truncate the data you insert. But that is ONLY if the MySQL server is setup without
   any strict SQL modes. Which was the case for a long time. But as of 5.6, the 
   default is to enable strict mode (as in my case) which will throw an error and
   NOT insert the data into the data base.
 * You will need to truncate your data before you insert into the database and not
   rely on the user having a specific setting for their MySQL server. Otherwise 
   they’ll have a massive error_log (mine was 135mb) and lots of data not saved.
 *  Thread Starter [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * (@gmariani405)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/database-issues-9/#post-5650688)
 * Addendum:
 * My issue was I moved a site from MySQL 5.1 to a new server with 5.6 which caused
   the issue.
 * [http://www.tocker.ca/2014/01/14/making-strict-sql_mode-the-default.html](http://www.tocker.ca/2014/01/14/making-strict-sql_mode-the-default.html)
   
   [http://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sql-mode-strict](http://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sql-mode-strict)
   [http://security.stackexchange.com/questions/61991/sql-truncation-vulnerability](http://security.stackexchange.com/questions/61991/sql-truncation-vulnerability)
 *  Plugin Author [Tom Braider](https://wordpress.org/support/users/tom-braider/)
 * (@tom-braider)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/database-issues-9/#post-5650768)
 * Thanks for the hint.

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

The topic ‘Database issues’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/count-per-day_d2a1c1.svg)
 * [Count per Day](https://wordpress.org/plugins/count-per-day/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/count-per-day/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/count-per-day/)
 * [Active Topics](https://wordpress.org/support/plugin/count-per-day/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/count-per-day/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/count-per-day/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Tom Braider](https://wordpress.org/support/users/tom-braider/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/database-issues-9/#post-5650768)
 * Status: not resolved