I have created a basic page with php and MySQL, but somehow i seem to be getting this error. I Have tried entering my MySQL server password but it shows the same error anyway. I am hosting this page from 000webhost and i have just been introduced to coding.
<?php
$username= filter_input(INPUT_POST,'username');
$password= filter_input(INPUT_POST,'password');
if (!empty($username)) {
if (!empty($password)) {
$host = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "project";
//create connection
$conn = new mysqli($host, $dbusername, $dbpassword, $dbname);
//check connection
if(!$conn)
{
die("connection failed: ". mysqli_connect_errno());
}
else{
echo "Connected successfully";
}
}
else{
echo "password should not be empty";
die();
}
}
?>