To set the record straight and for those who can't see the question because of low rep, here's the original question:
Trying to create an is_member function, to check whether the user is or is not a member.
Continually getting the same error despite doing as it says
$mysqli = new mysqli($servername, $user, $password, $dbname); //used to connect to the database
if ($mysqli->connect_error) {
die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}
// premium check function
function is_premium(){
$premium_query = mysqli_query($mysqli ,"SELECT 'is_member' FROM 'users' WHERE 'username' = '".$_SESSION['username']."' ");
$premium = mysqli_result($premium_query, 0, 'is_member');
if($premium =='1'){
return true;
}else{
return false;
}
}
?>
Pay particular attention to this bit:
SELECT 'is_member' FROM 'users' WHERE 'username'
Notice the quotes instead of ticks? I can't see why the question was closed with Warning: mysqli_query() expects parameter 1 to be mysqli, null given in
It had nothing to do with the problem. What he should have chosen as a duplicate question was When to use single quotes, double quotes, and backticks in MySQL
Prove me wrong.
My comment under the question stating that he chose the wrong question was removed and I have no idea why, which went along the lines of my telling him that he chose the wrong question to close it with.
It's pretty obvious that he downvoted perfectly good answers and closed some that I've answered to; I'm not the only one who has a problem with him, others do.
This is the classic the pot calling the kettle black.
There, I've said my piece and have "set the record straight". Now you know the "real" truth.