I don't understand why i get this error, i can't understand what's wrong..
The Error: Fatal error: Uncaught Error: Call to a member function query() on null
This is the code:
/**
* @category SQL Connection
* @description Connect to SQL Database
*/
$conn = new mysqli('server-0275.whmpanels.com', '---', '---', '---') or die(mysqli_error());
/**
* @sub-category Functions
* @description Main Functions
*/
// If it's home
if ($_SERVER['REQUEST_URI'] == '/' || $_SERVER['REQUEST_URI'] == '/index.php') {
/**
* @function Users
* @description Count registered users
*/
function users() {
$rs = $conn->query("SELECT MAX(`id`) AS `maxUsers` FROM `vrp_users`");
if ($row = mysqli_fetch_assoc($rs))
return $row['maxUsers'];
return 0;
}