title: MYSQL PHP while loop, do something if there aren't a given amount of rows returned
body: <p>I'm trying to figure out the best way to do something like this. Basically what I want to do (in a simple example) would be query the database and return the 3 rows, however if there aren't 3 rows, say there are 0, 1, or 2, then I want to put other data in place of the missing rows. </p>
  
  <p>Say my query returns 2 rows. Then there should be 1 list element returned with other data. </p>
  
  <p>Something like this:
  <a href="http://i42.tinypic.com/30xhi1f.png" rel="nofollow">http://i42.tinypic.com/30xhi1f.png</a></p>
  
  <pre><code>$query = mysql_query("SELECT * FROM posts LIMIT 3");
  while($row = mysql_fetch_array($query))
  {
    print "&lt;li&gt;".$row['post']."&lt;/li&gt;";
  }
  //(this is just to give an idea of what i would likkeee to be able to do
  else
  {
    print "&lt;li&gt;Add something here&lt;/li&gt;";
  }
  </code></pre>