title: PHP mysql_num_rows "no results" message?
body: <p>I have a MySQL keyword search on my website and it works fine. The problem is when someone searches a keyword I haven't added, nothing shows up on the results page. </p>
  
  <p>Instead of nothing showing up I would like to have a <code>no results found</code> message. </p>
  
  <p>So I used the code below:</p>
  
  <pre><code>if (mysql_num_rows($Recordset1) &gt; 0) {
      // no results
      echo 'No results found.';
  } else {
      do {
      // output
      } while($res = mysql_fetch_assoc($Recordset1));
  }
  </code></pre>
  
  <p>The problem is whenever I search a keyword knowing it is in my db, I get my results along with a <code>no results found</code> message. (The <code>no results found</code> message also appears on the top left of my webpage pushing my entire website down.) </p>
  
  <p>And when I searched a keyword I knew was not in my db, I didn't get a message at all, it showed nothing like before. </p>
  
  <p>I played around with the greater, less than, and equal signs and got similar problems. I was told my logic was backwards, but I'm not sure how it should look.</p>
  
  <p>Any help would be greatly appreciated, thanks in advance.</p>