是否可以将以下代码缩短为单个$ var? 我想要的是将mysqli_query和mysqli_fetch_assoc放在同一个$ query中
<?php
$datacenter=mysqli_connect('localhost','user','pass','db');
$query=mysqli_query - mysqli_fetch_assoc($datacenter, "SELECT
COUNT(pool_1) AS result FROM votes WHERE `answer` = '1'");
?>
所以我可以像这样显示回声
<?php echo number_format($query['result'],0,',','.'); ?>
能做到吗?