I want to retrieve the values on some condition i have attach the my table image below you can check it, basically i have to account the all Brukt = '0'
and group by Gruppe
, with 2 more conditions which are Brukernr LIKE '1612%' AND Periode = '2014-2'
As you can see the table and all my condition. My results must be a single array which have 5 values from S1 to S5. The issue is with my current query is that when they did not get any value then it not add it in array, and in result my array only contain those values which give results.
$sq3 = "select Brukt,
count(*)
from Brukere_periode
where Brukt = '0' AND Brukernr LIKE '1612%' AND Periode = '2014-2'
group by Gruppe";
$ru3 = mysqli_query($sq3);
while($sh = mysqli_fetch_array($ru3)){
$val[] += $sh[1];
}
It give the results like
Array
(
[0] => 28
[1] => 6
[2] => 2
)
in this array 0 contain S1 value
, 1 contain S3
and 2 contain S4
, i want my array must return S2 and S5
as well as a empty.