【发布时间】:2018-04-19 19:06:06
【问题描述】:
好的,我想知道总行数中正确的百分比 ( result=1 ) 结果 2 表示它仍然处于活动状态,因此只需要 result != 2 的总行数
我有以下代码,但没有显示任何内容 我做错了什么(公平地说我仍然半信半疑)
$successq = mysqli_query($con,"SELECT COUNT(*) FROM `table`
WHERE `result` ='1'");
$success = mysqli_fetch_assoc($successq);
$totalq = mysqli_query($con,"SELECT COUNT(*) FROM `table`
WHERE `result` !='2'");
$total = mysqli_fetch_assoc($totalq);
$percent = ($success/$total) * 100;
【问题讨论】:
标签: php math mysqli percentage