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.
- The topic ‘SQL Syntax Errors – Table Prefixes’ is closed to new replies.