php - Fatal error: Call to a member function bind_param() on boolean -


i'm busy on function gets settings db, , suddenly, ran error:

fatal error: call member function bind_param() on boolean in c:\xampp2\htdocs\application\classes\class.functions.php on line 16 

normally, mean i'm selecting stuff unexisting tables , stuff. in case, 'm not...

here's getsetting function:

public function getsetting($setting) {     $query = $this->db->conn->prepare('select value, param ws_settings name = ?');     $query->bind_param('s', $setting);     $query->execute();     $query->bind_result($value, $param);     $query->store_result();     if ($query->num_rows() > 0)     {         while ($query->fetch())          {             return $value;             if ($param === '1')             {                 $this->tpl->createparameter($setting, $value);             }         }     }     else     {         __('invalid.setting.request', $setting);     } } 

the $this->db variable passed through constructor. in case of need, here it:

public function __construct($db, $data, $tpl) {     $this->db = $db;     $this->tpl = $tpl;     $this->data = $data;     $this->data->setdata('global', 'theme', $this->getsetting('theme')); } 

also, since i'm making use of database, database connection:

class database {     private $data;      public function __construct($data)     {     $this->data = $data;     $this->conn = new mysqli(       $this->data->getdata('database', 'hostname'),        $this->data->getdata('database', 'username'),        $this->data->getdata('database', 'password'),        $this->data->getdata('database', 'database')     );     if ($this->conn->errno)     {         __('failed.db.connection', $this->conn->errno);     }     date_default_timezone_set('europe/amsterdam'); } 

i've tested connection, 100% positive works intended. i'm setting db connection things in configuration file:

'database' => array(     'hostname' => '127.0.0.1',     'username' => 'root',     'password' => ******,     'database' => 'wscript' ) 

now weird thing is; table exists, requested setting exists, db exists, still, error won't leave. here's proof db correct:

img

the problem lies in:

$query = $this->db->conn->prepare('select value, param ws_settings name = ?'); $query->bind_param('s', $setting); 

the prepare() method can return false , should check that. why returns false, perhaps table name or column names (in select or where clause) not correct?

also, consider use of $this->db->conn->error_list examine errors occurred parsing sql. (i'll echo actual sql statement strings , paste phpmyadmin test, too, there's failing there.)


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -