Title: help for sql query in template
Last modified: October 6, 2018

---

# help for sql query in template

 *  [pecernet](https://wordpress.org/support/users/pecernet/)
 * (@pecernet)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/help-for-sql-query-in-template/)
 * Hello,
 * I would like to know if you can help me for a sql query?
    This query works well
   on phpmyadmin …
 * but I would like to integrate this request in my template in php but I can not
   manage with the class wpdb
 * is it possible to do this in php so that i can add to my template?
 *     ```
       select t.name from wp_terms t, wp_term_taxonomy tt, wp_term_relationships tr
       where t.term_id=tt.term_id AND tt.term_taxonomy_id=tr.term_taxonomy_id and tr.object_id=1939
       ```
   
 * Thank you

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [7 years, 8 months ago](https://wordpress.org/support/topic/help-for-sql-query-in-template/#post-10756515)
 * What is it you’re trying to accomplish?
 *  Thread Starter [pecernet](https://wordpress.org/support/users/pecernet/)
 * (@pecernet)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/help-for-sql-query-in-template/#post-10756736)
 * I would like to display all the taxonomy, the terms of the product (woocommerce)
   
   when i use this request via phpmyadmin it works and i would like to succeed the
   same thing in my template
 * thanks
 *  Thread Starter [pecernet](https://wordpress.org/support/users/pecernet/)
 * (@pecernet)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/help-for-sql-query-in-template/#post-10756830)
 * I find this solution
 * `$terms = get_the_terms( $post->ID , 'product_brand' ); foreach( $terms as $term){
   print $term->name; unset($term); }`
 * 🙂
    -  This reply was modified 7 years, 8 months ago by [pecernet](https://wordpress.org/support/users/pecernet/).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘help for sql query in template’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [pecernet](https://wordpress.org/support/users/pecernet/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/help-for-sql-query-in-template/#post-10756830)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
