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
我該怎麼辦?