title: mysqli_query() expects parameter 1 to be mysqli, null given
body: <p>I am trying to follow a YouTube tutorial to build a CMS. I am starting to get really confused about the error messages it's creating. I get the following error</p>
  <blockquote>
  <p>Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home/a8241081/public_html/index.php on line 7</p>
  </blockquote>
  <p>Is my code right? Should there be a mysqli_select statement?</p>
  <pre><code>&lt;?php
  $db_host = &quot;********&quot;;
  $db_username = &quot;******&quot;; 
  $db_pass = &quot;*******&quot;; 
  $db_name = &quot;********&quot;;
  mysqli_connect(&quot;$db_host&quot;,&quot;$db_username&quot;,&quot;$db_pass&quot;, &quot;$db_name&quot;) or die (&quot;could not connect to mysql&quot;);  
  ?&gt;
  </code></pre>
  <pre><code>&lt;?php
  session_start();
  require_once &quot;scripts/connect_to_mysql.php&quot;;
  
  //Build Main Navigation menu and gather page data here
  $sqlCommand = &quot;SELECT id, linklabel FROM pages ORDER BY pageorder ASC&quot;;
  $query = mysqli_query($myConnection,$sqlCommand);
  
  $menuDisplay='';
  while ($row=mysqli_fetch_array($query)){
      $pid=$row[&quot;id&quot;];
      $linklabel=$row[&quot;linklabel&quot;];
      
      $menuDisplay .='&lt;a href=&quot;index.php?pid=' . $pid . '&quot;&gt;' . $linklabel . '&lt;/a&gt;&lt;br/&gt;';
      
    }
    mysqli_free_result($query);
    //mysqli_close($myConnection); 
  ?&gt;
  </code></pre>