Question: ' ; / / Create connection $conn = new mysqli ( $servername, $username, $password, $dbname ) ; / / Check connection if ( $conn -

';
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error){
die("Connection failed: ". $conn->connect_error);
}
//query database
$result = $conn->query("select * from contacts");
//display the result
if ($result->num_rows >0){
// output data of each row
while($row = $result->fetch_assoc()){
echo "Name: ". $row["name"]."
".
"Email: ". $row["email"]."
".
"Phone: ". $row["phone"]."
";
}
} else {
echo "0 results";
}
echo "Connected successfully";
$conn->close(); // close connection
?>ulated content in your database table here is the DBContact.php file:

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!