1. Write a program to
connect the mysql-database and display connection status using PHP.
<HTML>
<HEAD>
<TITLE> MYSQL Connection Status</TITLE>
</HEAD>
<BODY BGCOLOR="BEIGE" SIZE=22 TEXT=BLUE>
<?php
$servername = "localhost";
$username = "man";
$password = "";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
echo "MySQL Connected successfully.";
?>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> MYSQL Connection Status</TITLE>
</HEAD>
<BODY BGCOLOR="BEIGE" SIZE=22 TEXT=BLUE>
<?php
$servername = "localhost";
$username = "man";
$password = "";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
echo "MySQL Connected successfully.";
?>
</BODY>
</HTML>
No comments :
Post a Comment