简体   繁体   English

PHP 警告:除以零

[英]PHP Warning :Division by zero

When I try to see my average scores for my table labeled tools, I keep getting this error Warning: Division by zero in /home/xxxxx/xxxxx/Exercise5/showResults_step7.php on line 167 SUM for CSS: and AVE = nan当我尝试查看标记为工具的表格的平均分数时,我不断收到此错误警告:在 /home/xxxxx/xxxxx/Exercise5/showResults_step7.php 的第 167 行 SUM 中除以零:和 AVE = nan

I changed the name of my project with XXXX's for confidential reasons出于保密原因,我将项目名称更改为 XXXX

My lecture video had my professor doing this same things as I did below so I do not see why I am getting this error我的讲座视频让我的教授做了我在下面做的同样的事情,所以我不明白为什么我会收到这个错误

echo ' SUM for CSS: '. echo ' CSS 的总和:'。 $firstrow[0]. $第一行[0]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[0] / $rows, 2). number_format($firstrow[0] / $rows, 2)。 ' '
'; '; echo ' SUM for Filezilla: '. echo 'Filezilla 的总和:'。 $firstrow[1]. $第一行[1]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[1] / $rows, 2). number_format($firstrow[1] / $rows, 2)。 ' '
'; '; echo ' SUM for HTML: '. echo ' HTML 的总和:'。 $firstrow[2]. $第一行[2]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[2] / $rows, 2). number_format($firstrow[2] / $rows, 2)。 ' '


'; '; echo ' SUM for SurveyMonkey: '. echo 'SurveyMonkey 的总和:'。 $firstrow[3]. $第一行[3]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[3] / $rows, 2). number_format($firstrow[3] / $rows, 2)。 ' '

'; '; echo ' SUM for Pixlr: '. echo ' Pixlr 的总和:'。 $firstrow[4]. $第一行[4]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[4] / $rows, 2). number_format($firstrow[4] / $rows, 2)。 ' '

'; '; echo ' SUM for MySQLworkbench: '. echo ' MySQLworkbench 的总和:'。 $firstrow[5]. $第一行[5]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[5] / $rows, 2). number_format($firstrow[5] / $rows, 2)。 ' '

'; '; echo ' SUM for Atom: '. echo ' Atom 的总和:'。 $firstrow[6]. $第一行[6]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[6] / $rows, 2). number_format($firstrow[6] / $rows, 2)。 ' '

'; '; echo ' SUM for Screencast: '. echo 'SUM for Screencast: '。 $firstrow[7]. $第一行[7]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[7] / $rows, 2). number_format($firstrow[7] / $rows, 2)。 ' '

'; '; echo ' SUM for Python: '. echo ' Python 的总和:'。 $firstrow[8]. $第一行[8]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[8] / $rows, 2). number_format($firstrow[8] / $rows, 2)。 ' '

'; '; echo ' SUM for Googlesheets: '. echo '谷歌表格的总和:'。 $firstrow[9]. $第一行[9]。 ' and AVE = '. ' 和 AVE = '。 number_format($firstrow[9] / $rows, 2). number_format($firstrow[9] / $rows, 2)。 ' '

'; '; // add closing div tag echo ''; // 添加结束 div 标签 echo '';

what's the value of $rows in line 167?第 167 行中 $rows 的值是多少?

echo ' SUM for CSS: ' . $firstrow[0] . ' and AVE = ' . number_format($firstrow[0] / $rows, 2) // <= ¿whats the value of $rows here?

cause if it's 0 that could be the problem.因为如果它是0,那可能是问题所在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM