I'm working on a system that will be able to tell the user if the class they are trying to sign up for is full. So I fetch the record from my database using the snippet below where $camp is the $camp they choose and $conn is the database connection. I know that part is working correctly as I've been using it for other pieces.
$full = false;
function CheckFull($conn,$camp)
{
//construct SQL string to get desired record
$sql = "SELECT * FROM camps WHERE name='" . $camp . "' AND archive='0'";
//SQL query and fetching array to grab variables
$result = mysqli_query($conn, $sql);
$event = mysqli_fetch_array($result);
$max = $event['maxparticipant'];
$current = $event['participants'];
//Check Conditions for Fullness
if($max<=$current)
{
$full = true;
}
else
{
$full = false;
}
}
I've fetched many records like this before and had them echo on the page they need to display on but when comparing these two variables from the desired row I can never get it to return true even though in my database maxparticipant is < participants. Both columns are structured for integers. I'm wondering if because they are fetched from a database if there is some type issues going here?