Hi all i want to search n/a value including 0 value in one loop and send this value in another loop with categories. my code is
$i=0;
$j=0;
$newcount=$db->get_results("SELECT s2.qcategory, s1.id, count(s1.na) as na_count FROM (select distinct `qcategory` from store) s2 left join store s1 on s1.`qcategory` = s2.`qcategory` and s1.survey_name='$userID' and s1.dateone='$dateVal' and s1.branch='$branch' and s1.`na` = '1' group by 1 order by s1.id ");
if($newcount)
foreach($newcount as $sqcount)
{
$arval[$j]=$sqcount->na_count;
$j++;
}
$newqcat=$db->get_results("SELECT count(id) as r_count, sum(point) as point_value,dateone, na, qcategory FROM store where survey_name='$userID' and dateone='$dateVal' and branch='$branch' group by qcategory order by id");
if($newqcat)
{
foreach($newqcat as $sqcat1)
{
echo $sqcat1->qcategory?></a>
$vv1=$arval[$i];
$tcount_val1=$sqcat1->r_count-$vv1;
$rowval=$sqcat1->qcategory;
$per=($sqcat1->point_value*100)/($tcount_val1*5);
}
}
I want to count each category’s not applicable value like
**First impression - 3
Quality and value -0
Overall impression and ambiance - 1**
and deduct each n/a value in another loop
Can any one please help me how to do this? I tried this using array but it wont work properly
1 Answer