title: What does the mysqli_error() expects parameter 1 to be mysqli, null given mean?
body: <p>I have this PHP page:</p>
  
  <pre><code>&lt;?php
  
  //$_GET['invite'] = kNdqyJTjcf;
  
  $code = mysqli_real_escape_string ($dbc, $_GET['invite']);
  
  $q = "SELECT invite_id FROM signups_invited WHERE (code = '$code') LIMIT 1";
  $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n&lt;br /&gt;MySQL Error: " . mysqli_error($dbc));
  
  if (mysqli_num_rows($r) == 1) {
      echo 'Verified';
  } else {
      echo 'That is not valid. Sorry.';
  }
  
  ?&gt;
  </code></pre>
  
  <p>This is returning the error <code>Warning: mysqli_error() expects parameter 1 to be mysqli, null given</code>.</p>
  
  <p>Any idea why?</p>