我有这个函数调用它时返回三个值。从函数返回多个值
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
这样
$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;
,但我不能让导致
'$ id = $ cashier_data ['cashierId']' – ficuscr 2013-03-01 20:17:55
如果确实回答了您的问题 – michi 2013-04-14 12:57:18