lpxxfaintxx Posted November 24, 2007 Share Posted November 24, 2007 [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 'AND wp_posts.ID = wp_term_relationships.object_id AND wp_term_relationships.' at line 7] SELECT DISTINCT ID, post_title, post_date, wp_terms.term_id as post_category FROM wp_posts, wp_terms, wp_term_relationships, wp_term_taxonomy WHERE wp_terms.term_id = AND wp_posts.ID = wp_term_relationships.object_id AND wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id = wp_terms.term_id AND ID != 500 AND post_status = 'publish' ORDER BY post_date DESC LIMIT 400 Any idea what's wrong? Quote Link to comment https://forums.phpfreaks.com/topic/78696-mysql-syntax-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 24, 2007 Share Posted November 24, 2007 WHERE wp_terms.term_id = AND Since we don't know what you intended to compare wp_terms.term_id to in your query, it would be a little hard for anyone one here to solve this for you. Quote Link to comment https://forums.phpfreaks.com/topic/78696-mysql-syntax-error/#findComment-398269 Share on other sites More sharing options...
lpxxfaintxx Posted November 24, 2007 Author Share Posted November 24, 2007 Does this help? $category_check = " WHERE {$tp}terms.term_id = " . $c->cat_ID . " "; $last_posts = (array)$wpdb->get_results(" SELECT DISTINCT ID, post_title, post_date, {$tp}terms.term_id as post_category FROM {$tp}posts, {$tp}terms, {$tp}term_relationships, {$tp}term_taxonomy {$category_check} AND {$tp}posts.ID = {$tp}term_relationships.object_id AND {$tp}term_relationships.term_taxonomy_id = {$tp}term_taxonomy.term_taxonomy_id AND {$tp}term_taxonomy.term_id = {$tp}terms.term_id {$ddop_inc_current} AND post_status = 'publish' ORDER BY post_date {$newest_check} LIMIT {$ddop_num} Quote Link to comment https://forums.phpfreaks.com/topic/78696-mysql-syntax-error/#findComment-398275 Share on other sites More sharing options...
fenway Posted November 25, 2007 Share Posted November 25, 2007 Not really... your variable is nothing. Quote Link to comment https://forums.phpfreaks.com/topic/78696-mysql-syntax-error/#findComment-398465 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.