function add_member($idmembers, $firstname, $lastname, $email, $phone, $level, $password) {
global $db;
$query = "INSERT INTO members
(idmembers, first, last, email, phone, level, password)
VALUES
($idmembers, '$firstname', '$lastname', '$email', '$phone', '$level', '$password')";
var_dump($query);
$db->exec($query);
}
This code gives me this error and information from the var dump:
string(224) "INSERT INTO members (idmembers, first, last, email, phone, level, password) VALUES (, 'Gina', 'Hill', 'hill@me.com', '7778889898', 'm', '803591803e3d6e646cd3ee4a35fee6dd')" Fatal error: Call to a member function exec() on null in J:\XAMPP\htdocs\WEBSITE\register.php on line 26
I've checked adding the query to the database to make sure the query is working and it works fine.