I really suggest you to try to learn the language. I never programmed in PHP but in c++, c#, js.
Looks like this should solve the issue....
bind_param('s',$email);
$query->execute();
$->store_result();
if ($query->num_rows > 0) {
$error .= 'The email address is already registered!';
}else{
if (strlen($password) > 0){
$insertQuery->prepare("INSERT INTO users (name,email,password)VALUES (?,?,?);");
$insertQuery->bind_param($fullname, $email, $password_hash);
$result = $insertQuery->execute();
if ($result) {
$error .= 'Your registration was successful!';
} else {
$error .= 'Something went wrong!';
}
$insertQuery->close();
}
}
$query->close();
mysqli_close($db);