title: Displaying results in a search table (PHP)
body: <p>This has probably been asked before, please feel free to link me or whatever, I just couldn't find exactly what I'm after.</p>
  
  <p>It's pretty simple, I need to display the results of a search form. That part is easy and I can get that to work. What I'm having trouble with is when no results match what the user searched.</p>
  
  <p>I'm fairly certain I need to just use an IF statement but I'm not very experienced with PHP and cannot figure out how to correctly display the code.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>$query = "SELECT * FROM search WHERE isbn='$isbn' OR bookname='$bookname' OR author='$author' OR category='$category'";
  
  if (!$query)
  {
      echo "No results found in the database. Please go back and search again.";
  }
  </code></pre>
  
  <p><strong>My question is:</strong> How do I get the 'No results found...' message to display when the users search doesn't match anything in the database?</p>
  
  <p><strong>NOTE</strong> - I get very confused very quickly when it comes to trying to understand certain terms within PHP and SQL so please try to explain your answer like you would to an absolute beginner.</p>
  
  <p>Many thanks in advance.</p>