Title: Database values should be integer
Last modified: August 21, 2016

---

# Database values should be integer

 *  [spankmaster79](https://wordpress.org/support/users/spankmaster79/)
 * (@spankmaster79)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/database-values-should-be-integer/)
 * By writing my own code for getting values from this plugin I found out that the
   database table ‘wp_like_dislike_counters’ it creates uses VARCHAR(30) for the
   counting values.
 * This is really bad, since if you count stuff you should use integer and every
   standard query fails sorting.
 * To do something like getting the top vote you would write
 *     ```
       SELECT *
       FROM wp_like_dislike_counters
       WHERE ul_key =  'c_like'
       ORDER BY ul_value DESC
       ```
   
 * But this doesn’t work because the ORDER BY clause fails sorting correct. You 
   have to cast to integer using
 *     ```
       SELECT *
       FROM wp_like_dislike_counters
       WHERE ul_key =  'c_like'
       ORDER BY ABS( ul_value ) DESC
       ```
   
 * [http://wordpress.org/plugins/like-dislike-counter-for-posts-pages-and-comments/](http://wordpress.org/plugins/like-dislike-counter-for-posts-pages-and-comments/)

The topic ‘Database values should be integer’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/like-dislike-counter-for-posts-pages-
   and-comments_0fa2ff.svg)
 * [Like Dislike Counter](https://wordpress.org/plugins/like-dislike-counter-for-posts-pages-and-comments/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/like-dislike-counter-for-posts-pages-and-comments/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/like-dislike-counter-for-posts-pages-and-comments/)
 * [Active Topics](https://wordpress.org/support/plugin/like-dislike-counter-for-posts-pages-and-comments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/like-dislike-counter-for-posts-pages-and-comments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/like-dislike-counter-for-posts-pages-and-comments/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [spankmaster79](https://wordpress.org/support/users/spankmaster79/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/database-values-should-be-integer/)
 * Status: not resolved