title: if is not null in query mysqli
body: <p>I have multiple field and getting values from ajax method post and i want to filter table with this values.</p>
  
  <p>my query in page.php:</p>
  
  <pre><code>$status=$_POST['status'];
  $pname=$_POST['pname'];
  
  $qr1 = $mysqli-&gt;query(
      "SELECT id,uid,status,pname
       FROM `tbl1`,`tbl2`
       WHERE `id` IS NOT NULL AND `uid`=21 "
  );
  
  if(!is_null($_POST['status'])) {
      $qr1 .= (" AND `status` = '$status' ");
  }
  
  if(!is_null($_POST['pname'])) {
      $qr1 .= (" AND `product_name`='$pname' ");
  }
  
  $row1=$qr1-&gt;fetch_object();
  </code></pre>
  
  <p>but return null and query was empty!
  Where I was wrong??</p>