Guys this is mysql tables output. It show for month(Value) get count(Total) for a particular disease. Now I have a php array() of 12 months and I want to compare with that array and find that if for particular month their is no data returned from table add 0 for that month in other new array() of 12 months or else the value found from table.
Value | dname | Total
5 | Root Canal | 1
8 | Root Canal | 1
my code in php
foreach($ResultArray2[1] as $key => $val){
if(empty($row_d['Value'])){
$ResultArray2[$i][$key] = '0';
else
$ResultArray2[$i][$row_d['Value']] = $row_d['Total'];
This is what i get
Array ( [1] => Array ( [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 ) [2] => Array ( [5] => 1 [8] => 1 ))
this is what i need Array (
[1] => Array ( [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 ) [2] => Array ( [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 1 [6] => 0 [7] => 0 [8] => 1 [9] => 0 [10] => 0 [11] => 0 [12] => 0 ))
$ido? You wanna generate an array which will have 12 indexes each mapped to the count of disease in that month right?