This question already has an answer here:
i have this function on class called Bills that return three value when calling it.
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 );
}
now when call this function
$BillDraftSubmit = new Bills;
$BillDraftSubmit->GetCashierDetail(71);
i need to print the $cashier_data on variable like this
$ID = $BillsCashierID to using it on other way.
how can i read the value from this function from class
</div>
If it is a method you can use this:
$BillDraftSubmit = new Bills();
$data=$BillDraftSubmit->GetCashierDetail(71);
$id=$data["cashierId"];
Be careful, because in you question you have
$BillDraftSubmit = new Bills;
instead of
$BillDraftSubmit = new Bills();
If it is not a method you can use this:
$data=GetCashierDetail(71);
$id=$data["cashierId"];
your $ID should have the array in it
use
foreach($ID as $key => $val) {
echo $val['cashierId'];
....
}