我有这个函数在调用它时返回三个值。
function GetCashierDetail ($UserID){
$GetCashierID = "SELECT cashiers_CashierID,cashiers_Total,cashiers_Last_Total
FROM `cashiers`
WHERE `cashiers_CashierCloseDate` is null and `cashiers_Status`='0'
and `cashiers_Delete` = '0' and `cashiers_User` = '".$UserID."'";
$objQueryCashierID = mysql_query($GetCashierID) or die ("Error Query [".$strSQL."]");
$GetCashierIDResult = mysql_fetch_array($objQueryCashierID);
$BillsCashierID = $GetCashierIDResult['cashiers_CashierID'];
$CashierTotal = $GetCashierIDResult['cashiers_Total'];
$CashierLastTotal = $GetCashierIDResult['cashiers_Last_Total'];
$num = mysql_affected_rows();
// Return Data
return $cashier_data = array('cashierId' => $BillsCashierID ,
'CashierTotal' => $CashierTotal ,
'CashierLastTotal' => $CashierLastTotal);
}
现在调用这个函数时GetCashierDetail (11)
,我需要$cashier_data
像这样打印 on 变量:
$ID = $BillsCashierID
以其他方式使用它。
我会尝试:
class Bills {
// Get Cashier ID
function GetCashierDetail ($ausers_ID){
$GetCashierID = "SELECT cashiers_CashierID,cashiers_Total,cashiers_Last_Total
FROM `cashiers`
WHERE `cashiers_CashierCloseDate` is null and `cashiers_Status`='0'
and `cashiers_Delete` = '0' and `cashiers_User` = '".$UserID."'";
$objQueryCashierID = mysql_query($GetCashierID) or die ("Error Query [".$strSQL."]");
$GetCashierIDResult = mysql_fetch_array($objQueryCashierID);
$BillsCashierID = $GetCashierIDResult['cashiers_CashierID'];
$CashierTotal = $GetCashierIDResult['cashiers_Total'];
$CashierLastTotal = $GetCashierIDResult['cashiers_Last_Total'];
$num = mysql_affected_rows();
// Return Data
return $cashier_data = array('cashierId' => $BillsCashierID ,
'CashierTotal' => $CashierTotal ,
'CashierLastTotal' => $CashierLastTotal);
}
}
$BillDraftSubmit = new Bills();
$data = $BillDraftSubmit->GetCashierDetail(71);
$cashierId = $data["cashierId"];
$CashierTotal = $data["CashierTotal"];
$CashierLastTotal = $data["CashierLastTotal"];
echo "cashierId" . $cashierId;
echo "<br>CashierTotal" . $CashierTotal;
echo "<br>CashierLastTotal" . $CashierLastTotal;
但我无法得到结果。