• 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/

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