我是这里的初学者。我有两个问题。
这是我的查询:
$result = mysql_query( "select SUM(achievenum) as achieve_rows from games" );
$row = mysql_fetch_object( $result );
$total_achieve = $row->achieve_rows;
$result = mysql_query( "select SUM(achieveget) as get_rows from games" );
$row = mysql_fetch_object( $result );
$get_achieve = $row->get_rows;
$completed_rate = $get_achieve * 100 / $total_achieve;
如何使用一个查询而不是两个查询来制作此代码?
当我显示百分比时
表明
Completion Rate : 32.3529411765%
我需要它只显示前三个数字。
32.3 %