I'm doing, or trying to do, a database project for the university, but when registering a user this error appears:
Fatal error: Call to a member function bind_param() on a non-object in (...)
Initially I wrote
$insert = $db->prepare("INSERT INTO customer (name, email, phonenumber, adress, password) VALUES (?, ?, ?, ?, ?");
But then I changed to well, you can see in the code.
<?php
require 'db/connect.php';
require 'functions/security.php';
if(!empty($_POST)) {
    if(isset($_POST['name'], $_POST['email'], $_POST['address'], $_POST['phone'], $_POST['password'])) {
        $name = trim($_POST['name']);
        $email `enter code here` = trim($_POST['email']);
        $phone = trim($_POST['phone']);
        $address = trim($_POST['address']);
        $password  = trim($_POST['password']);
        if(!empty($name) && !empty($email) &&!empty($phone) && !empty($address) &&!empty($password)){
                $insert = $db->prepare("INSERT INTO customer VALUES (?, ?, ?, ?, ?");
                $insert->bind_param('ssiss', $name, $email, $phone, $address, $password);
                //$insert->close();
            if($insert->execute()){
                print_r("Done");
                die();
            }            
        }        
    }
}
?>
 
     
    