How to use the php function mysqli_connect() to work with phpMyAdmin databases.

I am a newbie to php and databases.
I followed the openSuSE LAMP guide. I installed the mariadb and phpMyAdmin . I opened a port in the firewall for a mysql database server.

In a browser (Chromium):
localhost/index.htm displays “It works”
localhost/phpinfo.php displays PHP version 7.0.7. The section for mysqli is present.
localhost/phpMyAdmin pulls up phpMyAdmin

I created a new database, created several tables and several relationships.

I created the file connectPHP.php:
$localhost = ‘localhost’;
$username = ‘root’;
$password = ‘password’;
$database_name = ‘databaseName’;
$db = mysqli_connect($localhost,$username,$password,$database_name)
or die(‘Error connecting to MySQL server.’);
– where password is the password used to get into phpMyAdmin, databaseName is the name of the database I created.

I placed this in /home/myName/public_html
localhost/~myName/connectPHP.php – gives the die message

I opened a terminal console with root privileges and copied the file into /srv/www/htdocs
localhost/connectPHP.php - also gives the die message

Any ideas? I think I am very close.
Thank you in advance

This comes from one of the sites I administer:

$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
echo "Connected successfully";

Adjust to your needs and it should work.

Thank you. This code worked. (Note: file is located in /srv/www/htdocs)