大家好,我想在一个循环中搜索 n/a 值,包括 0 值,并在另一个循环中发送该值与类别。我的代码是
$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);
}
}
我想计算每个类别的不适用值,例如
**First impression - 3
Quality and value -0
Overall impression and ambiance - 1**
并在另一个循环中扣除每个 n/a 值
任何人都可以帮助我如何做到这一点?我用数组试过了,但它不能正常工作