title: Error - 'trying to access array offset on value of type null'
body: <p>I continually get the error: 'trying to access array offset on value of type null' at the lines where my session variables are defined.
  I have looked around the web/ on stack and at my code, and I cannot figure out what is wrong! This is my first time defining session variables from two different tables in the one document/ code page, so I suspect it is something to do with that.
  Below is the PHP code whereby the error is occurring:</p>
  <pre><code>&lt;?php
  
      session_start();
  
      include('../includes/dbh.inc.php');
  
  
      $sql = 'SELECT * FROM shelfitems';
      $lqs = 'SELECT * FROM shelfwebsites';
  
      $result = mysqli_query($conn, $sql);
      $result2 = mysqli_query($conn, $lqs);
  
      $shelfitems = mysqli_fetch_all($result, MYSQLI_ASSOC);
      $shelfwebsites = mysqli_fetch_all($result2, MYSQLI_ASSOC);
      $shelfwebsite = mysqli_fetch_assoc($result2);
      $shelfitem = mysqli_fetch_assoc($result);
  
      $_SESSION['parent_id'] = $shelfitem['parent_id'];
      $_SESSION['folder'] = $shelfwebsite['folder'];
      $parent_id = $_SESSION['parent_id'];
      $folder = $_SESSION['folder'];
      mysqli_close($conn);
  </code></pre>