title: On a function that gets settings from a DB I ran into the error
body: <p>I'm busy on a function that gets settings from a DB, and suddenly, I ran into this error:</p>
  
  <pre><code>Fatal error: Call to a member function bind_param() on boolean in C:\xampp2\htdocs\application\classes\class.functions.php on line 16
  </code></pre>
  
  <p>Normally, this would mean that I'm selecting stuff from unexisting tables and stuff. But in this case, I 'm not...</p>
  
  <p>Here's the <code>getSetting</code> function:</p>
  
  <pre><code>public function getSetting($setting)
  {
      $query = $this-&gt;db-&gt;conn-&gt;prepare('SELECT value, param FROM ws_settings WHERE name = ?');
      $query-&gt;bind_param('s', $setting);
      $query-&gt;execute();
      $query-&gt;bind_result($value, $param);
      $query-&gt;store_result();
      if ($query-&gt;num_rows() &gt; 0)
      {
          while ($query-&gt;fetch()) 
          {
              return $value;
              if ($param === '1')
              {
                  $this-&gt;tpl-&gt;createParameter($setting, $value);
              }
          }
      }
      else
      {
          __('invalid.setting.request', $setting);
      }
  }
  </code></pre>
  
  <p>The <code>$this-&gt;db</code> variable is passed through a constructor. In case of need, here is it:</p>
  
  <pre><code>public function __construct($db, $data, $tpl)
  {
      $this-&gt;db = $db;
      $this-&gt;tpl = $tpl;
      $this-&gt;data = $data;
      $this-&gt;data-&gt;setData('global', 'theme', $this-&gt;getSetting('theme'));
  }
  </code></pre>
  
  <p>Also, since I'm making use of a database, my database connection:</p>
  
  <pre><code>class Database
  {
      private $data;
  
      public function __construct($data)
      {
      $this-&gt;data = $data;
      $this-&gt;conn = new MySQLi(
        $this-&gt;data-&gt;getData('database', 'hostname'), 
        $this-&gt;data-&gt;getData('database', 'username'), 
        $this-&gt;data-&gt;getData('database', 'password'), 
        $this-&gt;data-&gt;getData('database', 'database')
      );
      if ($this-&gt;conn-&gt;errno)
      {
          __('failed.db.connection', $this-&gt;conn-&gt;errno);
      }
      date_default_timezone_set('Europe/Amsterdam');
  }
  </code></pre>
  
  <p>I've already tested the connection, 100% positive that it works as intended.
  I'm setting the DB connection things in a configuration file:</p>
  
  <pre><code>'database' =&gt; array(
      'hostname' =&gt; '127.0.0.1',
      'username' =&gt; 'root',
      'password' =&gt; ******,
      'database' =&gt; 'wscript'
  )
  </code></pre>
  
  <p>Now the weird thing is; the table exists, the requested setting exists, the DB exists, but still, that error won't leave. Here's some proof that the DB is correct:</p>
  
  <p><img src="https://i.stack.imgur.com/6YSL1.png" alt="IMG"></p>