The connection file is:
$DBconnect = mysqli_connect("localhost", "root", "", "project" );
And this works on all pages except one, which is giving this error: Undefined variable: DBconnect
for this part:
include_once('connection.php');
// Function that will convert a user id into their username
function getusername($uid) {
$res = mysqli_query($DBconnect, "SELECT username FROM users WHERE id='".$uid."' LIMIT 1") or die(mysql_error());
Thanks for advice