Title: Problem with variable inside get_results
Last modified: August 31, 2016

---

# Problem with variable inside get_results

 *  [darvsorceix](https://wordpress.org/support/users/darvsorceix/)
 * (@darvsorceix)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/problem-with-variable-inside-get_results/)
 * Hello , i have problem with variables:
 *     ```
       $episode = $_POST['episode'];
       $is_in_database = $wpdb->get_results(
       $wpdb->prepare("SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id = %d AND object_id IN (SELECT ID FROM wp_posts WHERE post_title = '1x04')", $get_term_taxonomy_id, $episode)) or die('Error');
       ```
   
 * Is working fine but whenever i am trying to use variable $episode it does not.
 *     ```
       $episode = $_POST['episode'];
       $is_in_database = $wpdb->get_results(
       $wpdb->prepare("SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id = %d AND object_id IN (SELECT ID FROM wp_posts WHERE post_title = %s)", $get_term_taxonomy_id, $episode)) or die('Error');
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [darvsorceix](https://wordpress.org/support/users/darvsorceix/)
 * (@darvsorceix)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/problem-with-variable-inside-get_results/#post-7068534)
 * I solved this problem by myself. Whenever i insert new record to database who
   had structure 1×04 , “x” was changed to “×” and this was made by errors in queries
   above.

Viewing 1 replies (of 1 total)

The topic ‘Problem with variable inside get_results’ is closed to new replies.

## Tags

 * [get_results](https://wordpress.org/support/topic-tag/get_results/)
 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [darvsorceix](https://wordpress.org/support/users/darvsorceix/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/problem-with-variable-inside-get_results/#post-7068534)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
