Kniggles Posted August 4, 2020 Share Posted August 4, 2020 Hi i have been trying to work out why this code will not add the data to the base, any pointer please? thanks in-advance. <?php // Database connection establishment $con=mysqli_connect("localhost","Deric","Password,"players"); // Check connection if (mysqli_connect_errno($con)) { echo "MySQL database connection failed: " . mysqli_connect_error(); } //CHECKING SUBMIT BUTTON PRESS or NOT. echo "successfull here "; if(isset($_POST["submitBtn"]) && $_POST["submitBtn"]!=""){ $name=$_POST["name"]; $email=$_POST["email"]; $message=$_POST["message"]; echo "$name"; echo "$email"; echo "$message"; echo "working ** "; //INSERT QUERY if(mysqli_query("INSERT INTO contact (name, email, message) VALUES ($name, $email, $message)")){ echo "Record inserted successfully"; }} ?> Link to comment Share on other sites More sharing options...
Funce Posted August 6, 2020 Share Posted August 6, 2020 You might be missing a quote mark in your $con line. What output are you getting? Any errors? Link to comment Share on other sites More sharing options...
Sherin Posted December 29, 2020 Share Posted December 29, 2020 You have missing the quote mark in when you define password Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now