Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions