0

This query is not working in xampp PMA:

SELECT `wp_posts`.`post_title`,`wp_terms`.`name`,`wp_terms`.`term_id`,`wp_term_taxonomy`.`taxonomy`
    FROM `wp_posts`,`wp_terms`,`wp_term_taxonomy`,`wp_term_relationships` 
    WHERE `wp_term_relationships`.`object_id` = `wp_posts`.`ID` AND `wp_posts`.`post_status` = 'publish' AND `wp_term_taxonomy`.`taxonomy` = 'stores'
AndrewShmig
  • 4,843
  • 6
  • 39
  • 68
Sultan
  • 1
  • 7
  • i doubt you are correcly joining the tables. You should use proper `INNER JOIN ... ON ...` instead the comma join syntax what is over 25 years old and very hard to read and maintain. – Raymond Nijland Apr 04 '18 at 21:12
  • sir actually i have data base of wordpress and i am trying to fetch the data of stores only – Sultan Apr 04 '18 at 21:18
  • What does `mysqli_multi_query()` have to do with this? You're only executing one query, and there's no PHP code here. – Barmar Apr 04 '18 at 21:19
  • 1
    @Sultan You need to specify the joining relationships between all 4 tables. You only have the relationship between `wp_term_relationshups` and `wp_posts`, not the rest. So you're getting a huge cross product. – Barmar Apr 04 '18 at 21:19
  • sorry sir i have no idea of this site i am a new fly in this site so sorry for that if you hav a answer for this than please help – Sultan Apr 04 '18 at 21:20
  • thanx for a quick reply now let me check your solutuon @barmar – Sultan Apr 04 '18 at 21:23
  • Like i said @Barmar the topicstarter should use proper INNER JOIN syntax.. – Raymond Nijland Apr 04 '18 at 21:53

0 Answers0