title: Putting an IF statement in SQL query if user has supplied data in that field
body: <p>I have a SQL query, where imputs are generated by the user via a search form.  What I have at the moment is this.</p>
  
  <pre><code>// Select some data
  $sth = $dbh-&gt;prepare("SELECT `id`, `type_code`, `connector_type`, `construction_type`,  `author`, `estimate_lead_time`, `last_update`, `confidence_level`, `start_passband`, `stop_passband`, `low_passband`, `high_passband` 
                        FROM `filter_bandpass` 
                        WHERE (`start_passband` = $lowfreq AND `stop_passband` = $highfreq)");
  </code></pre>
  
  <p>I'm trying to get it to allow users to only fill out the <code>$lowfreq</code> and leave the <code>$highfreq</code> blank, and the results will show all results where <code>$lowfreq =</code> to user inserted data, but when they do imput an amount for <code>$highfreq</code> the result shows both.</p>