Title: SQL Syntax Errors &#8211; Table Prefixes
Last modified: July 28, 2017

---

# SQL Syntax Errors – Table Prefixes

 *  Resolved [dansig](https://wordpress.org/support/users/dansig71/)
 * (@dansig71)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/sql-syntax-errors-table-prefixes/)
 * In version 2.3.2 of Sponsors in class-wp-sponsors-upgrade.php, there were three
   immediate syntax errors in the sql clauses, and quite a few more that I could
   see.
 * Line 68:
    `$results = $wpdb->get_results( 'SELECT * FROM' . $wpdb->prefix . '
   _postmeta WHERE meta_key like "'. $wpdb->prefix .'_sponsors_img"', OBJECT );`…
   should be… `$results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix .'
   postmeta WHERE meta_key like "'. $wpdb->prefix .'_sponsors_img"', OBJECT );` (
   notice the lack of space after FROM and the underscore before postmeta)
 * The same problem is popping up throughout the code on this page: anywhere you
   use $wpdb->prefix, the following tablename does not need the underscore.

Viewing 1 replies (of 1 total)

 *  [janhenckens](https://wordpress.org/support/users/janhenckens/)
 * (@janhenckens)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/sql-syntax-errors-table-prefixes/#post-9392410)
 * Hey
 * Thanks for catching that! Will be fixed in the next release.
 * Cheers
    Jan

Viewing 1 replies (of 1 total)

The topic ‘SQL Syntax Errors – Table Prefixes’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-sponsors_e7e7e7.svg)
 * [Sponsors](https://wordpress.org/plugins/wp-sponsors/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-sponsors/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-sponsors/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-sponsors/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-sponsors/reviews/)

## Tags

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

 * 1 reply
 * 2 participants
 * Last reply from: [janhenckens](https://wordpress.org/support/users/janhenckens/)
 * Last activity: [8 years, 10 months ago](https://wordpress.org/support/topic/sql-syntax-errors-table-prefixes/#post-9392410)
 * Status: resolved