title: How do you display a "No Results Found" message (PHP)
body: <p>Just wondering how I can display this message when I type something in my search bar, and nothing matches what is stored in my MySQL database.</p>
  
  <p>So far what I have is this.</p>
  
  <pre><code>&lt;?php
  
  if(isset($_POST['submit'])){
      $search = trim($_POST['search']);
      if($search != ""){
          //echo "search: ". $search;
          $result = mysql_query("SELECT * FROM catalogue WHERE 
              name LIKE '$name' OR 
              category LIKE '$category' OR
              brand LIKE '$brand' OR
              season LIKE '$season' OR
              price LIKE '$price' OR 
              store LIKE '$store' OR 
              description LIKE '%$search%' ");
  
          while($row = mysql_fetch_array($result)){
              $name = $row['name'];
              $file = $row['file'];
              $description = $row['description'];
              $category = $row['category'];
              $brand = $row['brand'];
              $season = $row['season'];
              $price = $row['price'];
              $store = $row['store'];
              $cid = $row['cid'];
  
              echo "\n&lt;div class=\"thumb\"&gt;";
              echo "\n\t&lt;a href=\"single.php?cid=$cid\"&gt;&lt;img src=\"thumbs/$file\" class=\"thumbnailImg\" width=\"150\" height=\"200\"/&gt;&lt;/a&gt;&lt;br/&gt;";
              echo "\n\t".$name. " ";
              echo "\n\t$". $price;
              echo "\n&lt;/div&gt;";
          }//end while loop
  
      }else{
          echo "&lt;h2&gt;&lt;em&gt;No results were found.&lt;/em&gt;&lt;/h2&gt;";
      }//end if search ,else
  
    }//end if submit
  ?&gt;
  </code></pre>
  
  <p>This code snippet works if I just click search without typing anything in, but if I type something in the search that doesn't match up, nothing is displayed. How do I fix that?</p>