Wordpress PHP variables in get_results()
<p>I have a function that works fine when I say</p>

<pre><code>$results = $wpdb-&gt;get_results(
                "SELECT meta_value 
                FROM wp_woocommerce_order_itemmeta 
                WHERE order_item_id = '21'
                AND meta_key = '_qty"
            );
</code></pre>

<p>This function returns 4, which is the correct number I would be looking for in my database. </p>

<p>Unfortunately, this code  is returning an empty array to get_results(). There is something wrong in my code with passing a variable to $wpdb, does anyone have an idea?</p>

<pre><code>$results = $wpdb-&gt;get_results(
                "SELECT meta_value 
                FROM wp_woocommerce_order_itemmeta 
                WHERE order_item_id =" .$order_item_id.
                "AND meta_key = '_qty'"
            );
</code></pre>