How to debug a MySQL query?

0

Is there any way to know what's wrong with this QUERY?

When you perform a query, it displays it on the screen but nothing appears, var_dump returns NULL , what steps does a professional perform to find out what is wrong with a query? (I'm new to back end)

$query = $wpdb->get_results( "SELECT display_name, post_title, name

FROM $wpdb->terms 

INNER JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id 

INNER JOIN $wpdb->term_relationships ON $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_id

INNER JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->term_relationships.object_id AND $wpdb->posts.post_type = 'noo_resume' 

INNER JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author 

INNER JOIN $wpdb->usermeta ON $wpdb->usermeta.user_id = $wpdb->users.ID AND $wpdb->usermeta.meta_key = '_jm_candidate_field_clocknow_user_btn' AND $wpdb->usermeta.meta_value = 'value_2';" );

foreach ($query as $vaga) {                 
  echo 'Nome: ' .$vaga->display_name. '<br>';
  echo 'Currículo: ' .$vaga->post_title. '<br>';
  echo 'Cargo: ' .$vaga->name. '<br>';
  echo '<hr>';
}

Table Relational Model

asked by anonymous 10.02.2017 / 16:12

0 answers