title: Excluding a variable when its value is blank
body: <p>The code below works great.  I have a MySQL database that contains book titles classified in different categories.  In the code below, the variable "site" represents a book title.  Each category is represented by a different table in the MySQL database.</p>
  
  <p>The code below ranks the top 25 book titles (site) by total votes across all categories (MySQL tables).  I am trying to exclude blank book titles (i. e. when site = '').  How can I do this?</p>
  
  <p>I have tried inserting <code>WHERE site != ''</code> in a few places but I get an error message.  So I guess I'm asking, where can I insert <code>WHERE site != ''</code>?</p>
  
  <p>Thanks in advance,</p>
  
  <p>John</p>
  
  <pre><code>&lt;?
  
  mysql_connect("mysqlv10", "username", "password") or die(mysql_error());
  mysql_select_db("database") or die(mysql_error());
  
  $result = mysql_query("SHOW TABLES");
  $tables = array();
  while ($row = mysql_fetch_assoc($result)) {
      $tables[] = '`'.$row["Tables_in_bookfeather"].'`';
  
  }
  
  $subQuery = "SELECT site, votes_up FROM ".implode(" UNION ALL SELECT site, votes_up FROM ",$tables);
  // Create one query that gets the data you need
  $sqlStr = "SELECT site, sum(votes_up) sumVotesUp
              FROM (
              ".$subQuery." ) subQuery
             GROUP BY site ORDER BY sum(votes_up) DESC LIMIT 25";
  $result = mysql_query($sqlStr);
  
  $arr = array(); 
  echo "&lt;table class=\"samples2\"&gt;";
  while ($row = mysql_fetch_assoc($result)) { 
      echo '&lt;tr&gt;';
      echo '&lt;td class="sitename2"&gt;&lt;a href="booklookup3.php?entry='.urlencode($row["site"]).'&amp;searching=yes&amp;search=search"&gt;'.$row["site"].'&lt;/a&gt;&lt;/td&gt;';
      echo '&lt;td&gt;'.$row["sumVotesUp"].'&lt;/td&gt;';
      echo '&lt;/tr&gt;';
  } 
  
  echo "&lt;/table&gt;";
  
  
  
  ?&gt;
  </code></pre>