How to register user?

Check for user in DB works, but the details of the new user in the database are not sent. What could be the error?
<meta charset="UTF-8">
<?php
$link = mysqli_connect('localhost', "#", "#", "#");
if (mysqli_connect_error()) {
 die('cannot connect MySQL');
};
if ($_POST) {
 $email = $_POST["email"];
 $password = $_POST["password"];

 $query = "SELECT `email` FROM `users` WHERE email='" . mysqli_real_escape_string($link, $email) . "'";
 $result = mysqli_query($link, $query);
 if (mysqli_num_rows($result) > 0) {
 echo "This email is already registered";
 } else {
 $query = "INSERT INTO `users`('email', 'password') VALUES ('" . $email . "','" . $password . "')";
 if (mysqli_query($link, $query)) {
 echo "You are registered";
 } else {
 echo "error Occurred";
}
}
}
?>
<form method="post">
 <label for="email">Email</label>
 <input type="email" name="email" placeholder="Email address" required>
 <label for="password">Password</label>
 <input type="password" name="password" required>
 <button type="submit">Register</button>
</form>
April 4th 20 at 00:32
1 answer
April 4th 20 at 00:34
Solution
You've taken the email, password in single quotes here
$query = "INSERT INTO `users`('email', 'password')

In General, the database always returns an error in such cases, the catch can so echo "an error has Occurred" . mysqli_error($link);

Find more questions by tags MySQL