title: User levels with PHP
body: <p>What I'm trying to do is make it so that when a specific user level is set in my Database it shows up specific text. Here is my code.</p>
  
  <pre><code>$userget = mysql_query("SELECT * FROM `usertable` WHERE `username`='".$_SESSION['user']."'");
  $user = mysql_fetch_array($userget);
  
  function getUserlevel() {
      if($user['userlevel'] == '1') { echo "Regular User"; }
  elseif($user['userlevel'] == '2') { echo "Moderator"; }
  elseif($user['userlevel'] == '3') { echo "Administrator"; }
  else { echo "Undefined"; }
  }
  </code></pre>
  
  <p>I know the function is working, because the Echo of Undefined works, which I set up as a test but the others are not working despite my user level being set to 3 and only echoing Undefined. A session is also set for when the user is logged in. </p>
  
  <p>This is when the function is called.</p>
  
  <pre><code>&lt;div class="userData"&gt;Welcome Back, &lt;?php echo $_SESSION['user']; ?&gt;&lt;hr /&gt;&lt;?php 
  getUserlevel(); ?&gt;&lt;/div&gt;
  </code></pre>