When ever users click on the submit button on my website to submit an entry, they get redirected to a different page with the feedback:
Connection Failed:Access denied for user 'root'@'localhost' (using password: NO)
The database is called 'circlecu_resultorientedmarket' and the table is named 'registration'.
$name = $_POST['Name'];
$phone = $_POST['Phone'];
$email = $_POST['Email'];
$message = $_POST['Message'];
$conn = new mysqli('localhost','root','','circlecu_resultorientedmarket');
if($conn -> connect_error){
die('Connection Failed:'.$conn->connect_error );
}else{
$stmt = $conn->prepare("insert into registration(Name, Phone, Email, Message)
values(?,?,?,?)");
$stmt ->bind_param("ssss",$name,$phone,$email,$message);
$stmt -> execute();
$stmt->close();
$conn->close();
echo "<h2>Thank you, $name </h2>";
echo '<p style="font-size:20px;">Your account has been created successfully</p>';
}
?> ```
How can I resolve this error?