title: PHP losing variable after an error message is called
body: <p>I am losing my varible $user once I call my error function and include the footer file. I use the $user function in my footer to display some information, but when I went to var_dump it, it just says null. Note, I am using a database framework that someone created, so the query might look weird, but it is 100% functional and secured.</p>
  
  <p>This is in my /includes/functions file:</p>
  
  <pre><code>$user_query = $db-&gt;query("SELECT * FROM `users` WHERE `id`='$_COOKIE[id]' LIMIT 1");
  $user = $db-&gt;getArray($user_query);
  
  function error($input){
  
              echo '&lt;div id="error_box"&gt;&lt;h1&gt;Ooops!&lt;/h1&gt;&lt;br&gt;
               '.$input.'&lt;br /&gt;&lt;a href="javascript:history.go(-1)"&gt;&lt;b&gt;Back to previous page.&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;';
  
     require_once('./layout/footer.php');
     die;
  
  }
  </code></pre>
  
  <p>and my /layout/footer.php file is:</p>
  
  <pre><code>         if (!empty($user['active'])){
  
             //info here
  
           }
           else {
  
              //info here
  
              var_dump($user);
  
           }
  </code></pre>