<?php
$LSum = 0;
while ( $dataApiUsage = $ResApiUsage->fetchAssoc() ) {
foreach ( $ResL as $RowL) {
if ($dataApiUsage['termid'] === $RowL->termid) {
$LCount++;
print $dataApiUsage['termname'];
print round($RowL->page_views/$LSum, 2);
print $RowL->page_views;
$LSum+= $RowL->page_views;
这是我从数据库(ORACLE)获取数据的循环。我刚添加此代码以获取每个条目的百分比。但由于除零,它在第一个循环中失败了。