title: Warning: mysql_num_rows() expects parameter 1 to be resource, null given in (not a boolean)
body: <p>I know a similar question has been answered but with my case i'm not using booleans I get this error</p>
  
  <blockquote>
    <p>Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /home3/arm103/public_html/battle.php on line 19</p>
  </blockquote>
  
  <p>here is battle.php from line 1 to 25</p>
  
  <pre><code>&lt;?php
  session_start();
  include("header.php");
  if(!isset($_SESSION['uid'])){
      echo "You must be logged in to view this page!";
  }else{
    if(isset($_POST['gold'])) {
      $energy = protect($_POST['energy']);
      $id = protect($_POST['id']);
      $user_check = mysql_query("SELECT * FROM `stats` WHERE `id`='".$id."'") or        die(mysql_error());
  if(mysql_num_rows($user_check) ==0) {
    output("There is no user with that ID!");
  }elseif($energy &lt; 1 || $energy &gt; 10) {
    output("You must attack with 1 - 10 energy!");
  }elseif($energy &gt; $stats['energy']){
    output("You do not have enough energy!");
  }elseif($id == $_SESSION['uid']) {
    output("You can not attack yourself!");
  }elseif(mysql_num_rows($attacks_check) &gt; 9) {
    output("This person has been already attacked the maximum of 10 times in the last 24 hours!");
  }else{
      $enemy_stats = mysql_fetch_assoc($user_check);
      $attack_effect = $energy * 0.1 * $stats['attack'];
      $defence_effect = $enemy_stats['defence'];
  </code></pre>
  
  <p>It would be great if someone could show me the problem thanks</p>