Testing mysqli Database Connection on Hosting
Let's now test the connection to the database via the mysqli extension using the following test code:
<?php
$host = ''; // host name
$name = ''; // database name
$user = ''; // username
$pass = ''; // password
$link = mysqli_connect($host, $user, $pass, $name);
$query = 'SELECT * FROM users';
$res = mysqli_query($link, $query) or die(mysqli_error($link));
var_dump($res);
?>
Substitute your credentials into the test code, then upload this code to your site and test the connection to the database.