title: mysqli_query() returning a boolean value
body: <p>I have a piece of PHP code I am using to grab the 20 next messages in a database.</p>
  
  <pre><code>&lt;?php
      $user_email_msg = "bob@gmail.com";
      $msg_email = "sam@gmail.com";
      $start_query_msg = 1;
      $end_query_msg = $start_query_msg-20;
      $user_link_msg = mysqli_connect("localhost", "root", "admin", $user_email_msg);
      $query_msg = "SELECT * FROM " . $msg_email . " WHERE id BETWEEN " . (string)$end_query_msg . " AND " . (string)$start_query_msg;
      $result_msg = mysqli_query($user_link_msg, $query_msg);
  
      $row_msg = mysqli_fetch_all($result_msg, MYSQLI_NUM);
  
      $next_20 = $row_msg[0];
  
      print_r($next_20);
  ?&gt;
  </code></pre>
  
  <p>When I run this code I get this error message:</p>
  
  <blockquote>
    <p>"Warning: mysqli_fetch_all() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\jayden\messages.php on line 10"</p>
  </blockquote>
  
  <p>I am so lost here, because I can't see any way that <code>$result_msg</code> can be returning a boolean value. </p>
  
  <p>How can I fix the issue?</p>