title: Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null
body: <p>Can somebody help me understand what it means because When I look at my code and compare it to the person that learning from I seem to not have any problem of having any mistake and I even tried to copy his code and I still get the </p>
  
  <blockquote>
    <p>Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli,
    null given in /home/daltonnapala/public_html/mysql/Grab.php on line 15</p>
    
    <p>Warning: mysqli_query() expects parameter 1 to be mysqli, null given
    in /home/daltonnapala/public_html/mysql/Grab.php on line 17</p>
    
    <p>Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result,
    null given in /home/daltonnapala/public_html/mysql/Grab.php on line 19</p>
  </blockquote>
  
  <p>Now I kinda do understand that having this expects parameter 1 to be mysqli, null given that it does not have the variables or something since I read some of the question and answers, but I still don't fully understand and why im having these warning or errors.</p>
  
  <p>Here is my code for the Sign up page:</p>
  
  <pre><code>&lt;?php
  
  if (array_key_exists('email', $_POST) OR array_key_exists('password', $_POST)){
  
      if ($_POST['email'] == ''){
  
          echo "&lt;p&gt;Please put in your email!&lt;/p&gt;";
  
      } else if ($_POST['password'] == ''){
  
          echo "&lt;p&gt;Please put in your Password!&lt;/p&gt;";
  
      } else {
  
          $query = "SELECT `id` FROM `users` WHERE email ='".mysqli_real_escape_string($link, $_POST['email'])."'";
  
          $result = mysqli_query($link, $query);
  
              if(mysqli_num_rows($result) &gt; 0){
  
                  echo "&lt;p&gt;That email address has already been sign in&lt;/p&gt;";
  
              }
  
      }
  
  }
  
  $link = mysqli_connect("localhost", "examplebb", "kle]cwdum)#]", "examplebb");
  if (mysqli_connect_error()) {
  
  die("Could not connect to database");
  
  }
  
   ?&gt;
  
  &lt;form method="post"&gt;
  
  &lt;input name="email" type="text" placeholder="Email"&gt;
  
  &lt;input name="password" type="password" placeholder="Password here"&gt;
  
  &lt;input type="submit" value="Sign up!"&gt;
  
  &lt;/form&gt;
  </code></pre>