Question: please solve the problem the problem is: a database is created but firstname,lastname, email, phone , message infomration is not added to the database. I

please solve the problem

the problem is: a database is created but firstname,lastname, email, phone , message infomration is not added to the database.

I have a correct html with correct action methods.

if (empty($username)){ if (empty($password)){

$host = "localhost"; $dbusername = "root"; $dbpassword = ""; $dbname = "contactdata"; // Create connection $conn = new mysqli ($host, $dbusername, $dbpassword, $dbname,"3308"); if (mysqli_connect_error()){ die('Connect Error ('. mysqli_connect_errno() .') ' . mysqli_connect_error()); } else{

$sql = "INSERT INTO contactdata (firstname, lastname,phone,email,message) values ('$firstname','$lastname','$phone','$email','$message')";

if ($conn->query($sql)){ echo "New record is inserted sucessfully"; } else{ echo "Error: ". $sql ." ". $conn->error; } $conn->close(); } } else{ echo "Password should not be empty"; die(); } } else{ echo "Username should not be empty"; die(); } ?>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!