title: PDO not searching when value is not set
body: <p>I would like to search genre and artist columns only if they are set. So if one of them is set to 'all' I would declared them 'NULL' and not search that column. This is what I came up with but it is not working.</p>
  
  <pre><code>if($genre=='all')
  {
      $genre=NULL;
  }
  if($artist=='all')
  {
      $artist=NULL;
  }
  
  $query=$conn-&gt;prepare('SELECT * FROM songs WHERE (genre=?) &amp;&amp; (artist=?)');
  $query-&gt;bindValue(1,$genre,PDO::PARAM_STR);
  $query-&gt;bindValue(2,$artist,PDO::PARAM_STR);
  $query-&gt;execute();
  $array=$query-&gt;fetchAll(PDO::FETCH_ASSOC);
  echo json_encode($array);
  </code></pre>