PHP Update keeps throwing error

I can’t seem to make this work. I’m trying to update my password in PHP, but it keeps throwing me an error. This is what it keeps saying.

Fatal error: Call to a member function bind_param() on a non-object in /update_password.php on line 29

It keeps point to the same line and I keep trying to modify it, but it just keeps throwing the same thing over and over. The table exists, the records exist, the column “password” exists, the column “email” exists, I just can’t put my mind on what’s going on.

Here’s the portion of the code that it keeps pointing to.

$UPDATE_PROFILE = $CONNECTION->prepare("UPDATE users SET password = ? WHERE email = ?");

$BIND_POST_NEW = stripslashes(filter_var($_POST['newpass'], FILTER_SANITIZE_STRING));


It keeps pointing to the bind_param I have set up there.

If you do a var_dump of $UPDATE_PROFILE what gets output?

Same message. No other debugging error showed up. error_log is turned on or I wouldn’t be seeing that message. So I’m not sure what’s going on.

Have you created a mysqli object?


Does that state that $CONNECTION is a mysqli object?

Well, the MySQL connection is in MVC format.

Here’s the connection code.

class mysqliSingleton {

    private static $instance;
    private $db_connection;

    private function __construct() {

        $this->db_connection = new mysqli(MYSQLI_HOST, MYSQLI_USERNAME, MYSQLI_PASSWORD, MYSQLI_DATABASE);
        if($this->db_connection->connect_errno) {
            echo "Error, failed to connect to MySQL database. Please fix.";


    public static function init() {

        if(is_null(self::$instance)) {

              self::$instance = new mysqliSingleton();


        return self::$instance;

    public function __call($name, $args) {

        if(method_exists($this->db_connection, $name)) {

            return call_user_func_array(array($this->db_connection, $name), $args);

        } else {

             trigger_error('Unknown Method ' . $name . '()', E_USER_WARNING);
             return false;




class Website_Connection {

    protected $CONNECTION;

    public function __construct() {
        $this->CONNECTION = mysqliSingleton::init();


The connection works. I’ve tested it via other templates. The only part that it doesn’t work is just the updating password. I’ve used the same method to login and it works. I strip the usersalt and $_POST[‘password’], then I bind them both together. Tried it with the login template. Works fine.

Only thing is, that was because all I was doing was selecting the data, but once I update the data, it doesn’t update.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.