This is my very first time uploading a website. now I’m having a problem with my hosting which is CPANEL.
I’m using the code
<?php
date_default_timezone_set("Asia/Manila");
$servername = "localhost";
$username = "root";
$password = "";
$db = "exampledb";
// Create connection
$conn = new mysqli($servername, $username, $password,$db);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
for my database connection.
Now my problem is what code should I put in servername? instead of localhost?
and same to the username root and password?
2
Answers
On the hosting site in cpanel they normally give you the server name that you can use, the password you will need to create a db user also on cpanel, this will be your user name and password.