title: Getting the number of posts a user has by the number of rows returned?
body: <p>So I have a question.
  I have chatting/IM website that I am working on and I was making a user profile page. I wanted to show how many posts that user had.</p>
  
  <p>Another issue I had earlier was that when I called a certain value it would return a 'Resource #1' type string. But I got that working by using </p>
  
  <pre><code>$totalposts=mysql_query("SELECT * FROM `posts` WHERE Username='" . $username . "'");
  $totalposts = mysql_fetch_row($totalposts);
  $totalposts = $totalposts[0];
  </code></pre>
  
  <p>But that just returns the last postID of the most recent post. I thought that mysql_num_rows would work. But this code returns an error (example with numbers):</p>
  
  <pre><code>29: $totalposts=mysql_query("SELECT * FROM `posts` WHERE Username='" . $username . "'");
  30: $totalposts = mysql_num_rows($totalposts);
  31: $totalposts =mysql_fetch_row($totalposts);
  32: $totalposts = $totalposts[0];
  </code></pre>
  
  <p>That returns this error:</p>
  
  <pre><code>Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in       /home/a9091503/public_html/im/user.php on line 31
  </code></pre>
  
  <p>Thanks guys. :) I hope you can figure this out. :D</p>