title: mysqli function returning no value
body: <p>ok i have a mysqli function that draws a users stat from a database.  the datbase is set up as</p>
  
  <p>username   attack   defense   strength<br>
  xxxx         10       10         10</p>
  
  <p>the problem i am running into is the function is returning nothing, the page is blank. my connection to the database present and session username is stored so i can figure out why its not working.</p>
  
  <p>config.php   </p>
  
  <pre><code> &lt;?php
   $dbhost = 'xxx'; 
   $dbuser = 'xxx';
   $dbpass = 'xxx';
   $dbname = 'xxx';
   $dberror1 = 'could not connect to database';
   $dberror2 = 'could not find selected table';
   ?&gt;
  </code></pre>
  
  <p>stat.php</p>
  
  <pre><code>&lt;?php
  function getLevel($stat) {
  require_once 'includes/config.php';
  
  $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  
  $stmt = $mysqli-&gt;prepare("SELECT ? FROM players WHERE username = ?");
  
  if($stmt) {
   $stmt-&gt;bind_param('ss', $stat, $_SESSION['username']);
   if($stmt-&gt;execute()) {
        $stmt-&gt;bind_result($result);
        $stmt-&gt;fetch();
         }
    }
    return $result;
    }  
  
  ?&gt;
  </code></pre>
  
  <p>and the file im using to test displaying the function</p>
  
  <pre><code>&lt;?php
  include 'includes/login-check.php';
  include 'includes/config.php';
  include 'includes/stat.php';
  
  echo getLevel('attack');
  ?&gt;
  </code></pre>