如何在php页面上添加两个mysql查询的结果?

时间:2018-07-07 13:39:58

标签: php mysql

我在一个PHP页面上有两个查询:

<?php
$query = "SELECT *, SUM(commission1) FROM agents WHERE b=1"; //GROUP BY commission1" 
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
    echo "Total = ". $row['SUM(commission1)'] . "  ";
}
?>

<?php
$query = "SELECT *, SUM(commission2) FROM agents WHERE b=2"; //GROUP BY commission2" 
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
    echo "Total = ". $row['SUM(commission2)'] . "  ";
}
?>

我想将两个结果添加到单独的行中。 我试图找到一种解决方案,但没有。

0 个答案:

没有答案