php-如何在一个查询中完成多个查询

如何在一个查询中完成以下查询,并按照下面的方式获取结果?

// Begining of January

$ob = MysqL_query(" SELECT SUM(salary_amount) AS total FROM teacherexpense WHERE  month(disburse_date)='01' AND  year(disburse_date)='$year' ");
$nt = MysqL_fetch_assoc($ob);
$salaryamount= $nt['total'];


$ob = MysqL_query(" SELECT SUM(other_expense_amount) AS expenseamount FROM otherexpense WHERE month(other_expense_date)='01' AND year(other_expense_date)='$year'  ");
$nt = MysqL_fetch_assoc($ob);
$expenseamount= $nt['expenseamount'];

$jk = MysqL_query(" SELECT SUM(amountpaid) AS revenue FROM studentpayment1 WHERE month(received_date)='01' AND year(received_date)='$year' ");
$t = MysqL_fetch_assoc($jk);
$revenue= $t['revenue'];

$ob = MysqL_query(" SELECT SUM(other_earning_amount) AS otherearningamount FROM otherearning WHERE month(other_earning_date)='01' AND year(other_earning_date)='$year' ");
$nt = MysqL_fetch_assoc($ob);
$otherearningamount= $nt['otherearningamount'];


$January= ($revenue+$otherearningamount)-($salaryamount+$expenseamount);
// End of January

解决方法:

将其填充到存储过程中?
PHP数据库驱动程序不允许您运行多个以;分隔的查询.出于安全原因.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...