title: MySQL query is not running properly
body: <p>Here is my code to run the mysql query, i am getting <code>$contactgroup</code> using ajax if <code>$contactgroup is not null or empty</code> it with run the query with AND but now its just running the query without and condition, i am printing the $contactgroup and $sql  its print the data but its not running the query with and condition, i have no clue why this one won't would work,</p>
  
  <pre><code>&lt;?php
  $contactgroup=$_GET['contactgroup'];
  print $contactgroup;
  
  $sql  = "SELECT * FROM contact where isdeleted = 0 ";
  print $sql;
  
  if ($contactgroup !="" &amp;&amp; $contactgroup !="Empty" ){
  
      print "contact group is null or empty";
  
      $contactgroup_exp = explode(',', $contactgroup);
      $sql .= " AND contactgroup in ('".implode("', '", $contactgroup_exp)."')";  
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>now my result for print query is </p>
  
  <pre><code>SELECT * FROM contact where isdeleted = 0
  </code></pre>
  
  <p>What i want like this if $contactgroup is not null or empty</p>
  
  <pre><code>SELECT * FROM contact where isdeleted = 0 AND contactgroup in ('xxxxxxx')
  </code></pre>
  
  <p>can anyone tell me where i went wrong,thanks</p>