title: How to search a row that has been joined with another table
body: <p>My query works when I don't try to search using the store_ID. Here is what I have that works. </p>
  
  <pre><code>&lt;?php
  $search = $mysqli-&gt; real_escape_string($_GET['store_ID']);
  $end = $mysqli-&gt; real_escape_string($_GET['end']);
  $start = $mysqli-&gt; real_escape_string($_GET['start']);
  $resultSet = $mysqli-&gt;query("SELECT * FROM orders
        INNER JOIN customers
        ON orders.store_ID=customers.store_ID
        WHERE order_date between '$start'  and '$end'
        AND PurchaseMethod LIKE 'deferred");
  
      if($resultSet-&gt; num_rows&gt;0){
        while($rows = $resultSet-&gt;fetch_assoc())
        {
              $storename= $rows['store_name'];
              $orderID = $rows['OrderID'];
              $storeID = $rows['store_ID'];
              $orderdate = $rows['order_date'];
              $purchaseMethod = $rows['PurchaseMethod'];
              $price = $rows['TotalPrice'];
  
              $output .= "&lt;tr&gt;&lt;td style='width:14.28%;'&gt;$storename&lt;/td&gt;
              &lt;td style='width:14.28%;'&gt;$orderID&lt;/td&gt;&lt;td style='width:14.28%;'&gt;$storeID&lt;/td&gt;
              &lt;td style='width:14.28%;'&gt;$orderdate&lt;/td&gt;&lt;td style='width:14.28%;'&gt;$purchaseMethod&lt;/td&gt;
              &lt;td style='width:14.28%;'&gt;$$price&lt;/td&gt;&lt;/tr&gt;";
            }
  
          }else{
            echo var_dump($resultSet);
            $output = "No results";
          }
          }
      ?&gt;
      &lt;?php echo $output; ?&gt;
  </code></pre>
  
  <p>This is what I'm trying to get to work:</p>
  
  <pre><code>$resultSet = $mysqli-&gt;query("SELECT * FROM orders
        INNER JOIN customers
        ON orders.store_ID=customers.store_ID
        WHERE order_date between '$start'  and '$end'
        AND PurchaseMethod LIKE 'deferred' AND store_ID = '$search'");
  </code></pre>
  
  <p>When I try to add the <code>AND store_ID = '$search'");</code> it gives me this error:</p>
  
  <blockquote>
    <p>Notice: Trying to get property of non-object in customerreportC.php on 
        line 66</p>
  </blockquote>