Title: SQL Error
Last modified: August 30, 2016

---

# SQL Error

 *  [njbebop](https://wordpress.org/support/users/njbebop/)
 * (@njbebop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/sql-error-32/)
 * Hello,
 * I was digging through our site error_log, and I keep seeing intermittent SQL 
   errors related to Simple Ad Manager…
 * `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'),
   0) AS aca...`
 * I did some digging and found where the query is generated in ad-class.php, line
   365…
 * `@aca := IFNULL((SELECT AVG(sa.ad_weight_hits*10/(sa.ad_weight*$cycle)) FROM 
   $aTable sa WHERE sa.pid = @pid AND sa.trash IS NOT TRUE AND {$whereClause} {$
   whereClauseT} {$whereClause2W}), 0) AS aca`
 * It appears that the variables $whereClause, $whereClauseT, and $whereClause2W
   are not being set and leaving an empty space in the query.
 * This isn’t a serious issue. Looking at the ads from the front end, the ads are
   delivering as they should be. I’m just curious as to what could be causing this
   error.
 * Thanks!
 * [https://wordpress.org/plugins/simple-ads-manager/](https://wordpress.org/plugins/simple-ads-manager/)

The topic ‘SQL Error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-ads-manager_73687f.svg)
 * [Simple Ads Manager](https://wordpress.org/plugins/simple-ads-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-ads-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-ads-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-ads-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-ads-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-ads-manager/reviews/)

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [njbebop](https://wordpress.org/support/users/njbebop/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/sql-error-32/)
 * Status: not resolved