Ok, I have my username set as 1 under admin and this other account set as 0 under admin. But it's not showing the page to any of the accounts and only showing the else statement. Does anyone know whats the problem? Im so confused and I have been staring at this code for a while now.
<?php
include("haha.php");
$cxn = mysqli_connect($dbhost,$dbuser,$dbpassword,$dbdatabase) or die("Couldn't connect to server");
$sql = "SELECT `admin` FROM `Member` WHERE `username`='{$_SESSION['username']}'";
$result = mysqli_query($cxn,$query) or die(mysqli_error($cxn));
$row = mysqli_fetch_array($result);
if($row['admin'] == 1)
{
There is code here that shows the page, but that works fine and I already tested it so I wont hog up the space with it. xD
}
}else{
echo "You aren't allowed to view this page because you are not admin.<br>
Click <a href='explore.php'>here</a> to go back to the site!";
}
?>