0
<?php
$con = mysqli_connect('localhost', 'root', '', 'Materniteti');
$f = "select count(*) as f from neonatologji where gjinia=1";
$m = "select count(*) as m from neonatologji where gjinia=2";
$s = $f + $m;
$result = mysqli_query($con, $s);
$row = mysqli_fetch_assoc($result);
echo $row["s"];
$percentage = number_format($f/$s) * 100 . '%';
?>
我想作一个百分比计算,其中的程序选择所有的女性性别并保存在$f
数量和所有在$m
而在男性$s
应保存的总和为f
和m
。但该程序不识别$m
,所以$s
不起作用。从数据库计数的数据来计算的百分比计算在PHP
我该怎么办?