呼び出すときに3つの値を返すこの関数があります。
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);
}
この関数を呼び出すとき、次のように on 変数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;
でもなかなか結果が出ません。