class memberclass {
function Available()
{
if(!$this->DBLogin()) {
$this->HandleError("Database login failed!");
return false;
}
$ux = $_SESSION['username_of_user'];
$qry = "Select (one='Not done') + (two='Not done') + (three='Not done') + (four='Not done') + (five='Note done') As num_not_done From $this->tablename Where username='$ux'";
$result = mysqli_query($this->connection, $qry);
$result_length = mysqli_num_rows($result);
echo "$result_length";
}
}
I'm trying to show the amount of available items. So for every column where the value is "Not done" for a user it should sum it up in the query to form the total amount of "Not done" items. However when I try to show this number with the following code, I get the value "1" for each user for some reason:
<?= $memberclass->Available(); ?>
"Select SUM((one='Not done') + (two='Not done') + (three='Not done') + (four='Not done') + (five='Note done')) As num_not_done From $this->tablename Where username='$ux'";` But it still gives the same result<? php code here ?>For the row in the link I sent you it would say: Tasks not completed: 5.