title: How to use isset and null variables in functions
body: <p>I have a fairly simple question I'm guessing. I have the following code at the beginning of my function, but it must not be correct because it causes the blank to turn blank. If I comment out the IF statement, everything runs fine.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Sorry, it's probably very basic...</p>
  
  <pre><code>function get_entries($order = 'newest', $slug = null) {
  
          $wheresql = '';
          if (isset($slug)) {  
              $wheresql = 'WHERE entries.category_id = (SELECT categories.category_id FROM categories WHERE categories.category_slug = "'. $slug .'")'
          }
  </code></pre>
  
  <p>Basically, I just want to do something if the user supplied a $slug variable, otherwise skip it.</p>
  
  <p>Thanks.</p>