How to check variable exist in database wordpress using $wpdb
<p>In Function.php, I want to check if my variable exist in a table of wordpress database, but it don't work.</p>

<pre><code>global $wpdb;
    $count = $wpdb-&gt;get_var($wpdb-&gt;prepare("SELECT COUNT(*) FROM $wpdb-&gt;pincode_distro1 WHERE pincode = $the_order-&gt;shipping_postcode"));
    if($count == 1) { echo 'distro 1'}
    else { echo 'distro 2'}
</code></pre>