Here is my function
function checkAvailability(){
//check
$session = $_COOKIE["PHPSESSID"];
$sql = "SELECT * FROM Account A INNER JOIN User U ON U.ID = A.USER_ID WHERE U.SESSION_ID = '$session';";
echo $sql;
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
.
.
.
}else{
echo "invalid user.";
}
}
this produces:
SELECT * FROM Account A INNER JOIN User U ON U.ID = A.USER_ID WHERE U.SESSION_ID = '9fqknqhc5usp3ngsjvmv8kih66'
and also goes in the else branch in the code
invalid user
Copy pasting this exact statement works on my MySQL database.
I'm wondering whats going wrong, I've checked that i'm using mysqli
everywhere but still i'm getting
0 results
Additionally,
my SESSION_ID
field is unique.