title: Wordpress database custom query to validate data
body: <p>I cant find any syntax for custom queries, use of $wpdb is new to me so can anyone help me solving this??</p>
  
  <pre><code> if(isset($_POST['submit']))
   {
     global $wpdb;
     $tablename='wp_form_subscribe';
  
     $myrows = $wpdb-&gt;get_results( "SELECT * FROM wp_form_subscribe   where     email=$wpdb-&gt;email" );
     if($myrows==0)
     {
      $data=array(
      'name' =&gt; $_POST['fullname'], 
      'age' =&gt; $_POST['age'],
      'email' =&gt; $_POST['email']);
      $wpdb-&gt;insert( $tablename, $data);
      }
     else 
     {
       $status='User already subscribed';
     }
     $status='';
    }
  </code></pre>