Problem is:
I want to count the number in my column r_start
where the r_start
dates are between my other two variables. But it always gives me the Error Notice: Undefined variable: z in [path] on line 173
. So it doesn't fill the variable, what makes me think that the COUNT
does not work porperly. I did a lot of reasearch and tried some things, but I simply don't find the cause..
$sqld = "SELECT r_start, COUNT (*) FROM reservation WHERE r_start BETWEEN '".$cid."' and '".$cod."' GROUP BY r_start";
if ($result = $con->query($sqld)) {
$z = mysqli_fetch_assoc($result);
}
This error only appears with the COUNT
tag. In my other queries it works absolutly fine.
f.e.:
$sqlc = "SELECT * FROM reservation where r_ende between '".$cid."' and '".$cod."'";
if ($result = $con->query($sqlc)) {
$y = mysqli_fetch_assoc($result);
}
Can anybody tell my why? Have I done something wrong?