I am trying to run this simple php code (in a file named "database.php")
<html>
<head>
</head>
<body>
<?php
$servername = 'localhost';
$username = 'admin';
$password = 'admin1';
//Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die('Connection failed: ' . $conn->connect_error);
}
else {
echo 'Connected Successfully.' ;
}
$conn->close();
?>
</body>
</html>
AND HERE IS THE OUTPUT IN MY BROWSER
connect_error)
{ die('Connection failed: ' . $conn->connect_error); }
else { echo 'Connected Successfully.' ; }
$conn->close();
?>
( the first part of php code get processed but later it shows just the source code)
PLEASE HELP.
$conn = new mysqli($servername, $username, $password, $db_name);