title: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
body: <p>I am getting the following error message on the code below (which is at the end of the query):</p>
  <blockquote>
  <p>Warning: mysql_num_rows(): supplied
  argument is not a valid MySQL result
  resource in ../view-ind-order.php on
  line 28</p>
  </blockquote>
  <p>This script is supposed to retrieve the order (from a page which lists all of the order_id rows from the orders table), the contents of the order, the user who ordered and the product information. I think where I'm getting the error is where there is more than one product within the order but I can't quite see where I'm going wrong. (the header has a session start command)</p>
  <pre><code>     &lt;?php 
        $page_title = 'Order';
        include ('./includes/header.html');
  
        if ( (isset($_GET['id'])) &amp;&amp; (is_numeric($_GET['id'])) )
        {    
         $id = $_GET['id'];
         } elseif ( (isset($_POST['id'])) &amp;&amp; (is_numeric($_POST['id'])) )
         {    
         $id = $_POST['id'];
         } else { 
         echo 'This page has been accessed in error';
         include ('./includes/header.html'); 
         exit();
        }
  
   require_once ('mydatabase.php'); 
  
   $query = &quot;SELECT us.users_id, us.users_first_name, us.users_surname, us.users_business, 
               ord.order_id, ord.users_id, ord.total, ord.order_date,  
               oc.oc_id, oc.order_id, oc.products_id, oc.quantity, oc.price
               prd.products_id, prd.products_name, prd.price      
           FROM users AS us, orders AS ord, order_contents AS oc, products AS prd  
           WHERE ord.order_id=$id
           AND us.users_id = ord.users_id
           AND ord.order_id = oc.order_id
           AND oc.products_id = prd.products_id    
           &quot;;
           
   $result = @mysql_query ($query); 
  
   if (mysql_num_rows($result) == 1) { 
  
      $row = mysql_fetch_array ($result, MYSQL_NUM);
  
      echo '
      &lt;table&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Name:&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;' . $row[1] . ' ' . $row[2] . '&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Business Name&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;' . $row[4] . '&lt;/td&gt;
      &lt;/tr&gt;   
      &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Total:&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;' . $row[7] . '&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Quantity&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;' . $row[12] . '&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Product:&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;' . $row[15] . '&lt;/td&gt;
      &lt;/tr&gt;   
      &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Price:&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;' . $row[13] . '&lt;/td&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
      ';
  
  } else { 
      echo '&lt;h1 id=&quot;mainhead&quot;&gt;Page Error&lt;/h1&gt;
      &lt;p class=&quot;error&quot;&gt;This page has been accessed in error.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;';   
  }
  mysql_close();
  
  include ('./includes/footer.html');
  ?&gt;
  </code></pre>