Title: SQL error on stats page
Last modified: August 20, 2016

---

# SQL error on stats page

 *  [don_alejandro](https://wordpress.org/support/users/don_alejandro/)
 * (@don_alejandro)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/sql-on-stats-page/)
 * While running on a testing server (set to show errors) I am seeing SQL errors
   caused by an un-slashed aprostrophe in an SQL statement (see error message below).
 * The problem is data that has not been through addslashes:
    ‘where’s hillary hosta’
   should have been ‘where\’s hillary hosta’
 * The problem can be fixed by adding
    $keywordData = addslashes($keywordData); 
   just above if($keyword_interval == “today”) which is line 131 in keyword stats.
   php.
 * WordPress database error: [You have an error in your SQL syntax; check the manual
   that corresponds to your MySQL server version for the right syntax to use near‘
   s hillary hosta’ AND stat_visitor_id not in(”)’ at line 1]
    select keyword,stat_visitor_id,
   visitor_id from wp_tts_keyword_stats where keyword=’where’s hillary hosta’ AND
   stat_visitor_id not in(”)
 * [http://wordpress.org/extend/plugins/track-that-stat/](http://wordpress.org/extend/plugins/track-that-stat/)

The topic ‘SQL error on stats page’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/track-that-stat.svg)
 * [Track That Stat](https://wordpress.org/plugins/track-that-stat/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/track-that-stat/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/track-that-stat/)
 * [Active Topics](https://wordpress.org/support/plugin/track-that-stat/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/track-that-stat/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/track-that-stat/reviews/)

## Tags

 * [sql-error](https://wordpress.org/support/topic-tag/sql-error/)

 * 0 replies
 * 1 participant
 * Last reply from: [don_alejandro](https://wordpress.org/support/users/don_alejandro/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/sql-on-stats-page/)
 * Status: not resolved