This seems so simple, but I just want to echo this and I can’t seem to figure out how to access the second part of the array. BillAddr is the first part and Line1 is the second part. It return nothing even though that feild has data
$Customer = $dataService->Query("SELECT * FROM Customer WHERE DisplayName='$anthonysname'"); echo "the given address line 1 is:" . $Customer->BillAddr[Line1] . "<br><br><br>"; //BillAddr/Line1
This is the array scheme
array(1) { [0]=> object(QuickBooksOnlineAPIDataIPPCustomer)#59 (72) { ["Taxable"]=> string(4) "true" ["BillAddr"]=> object(QuickBooksOnlineAPIDataIPPPhysicalAddress)#90 (16) { ["Id"]=> string(4) "1163" ["Line1"]=> string(36) "3415 dhfjdf Pike, Suite 301" ["Line2"]=> NULL ["Line3"]=> NULL ["Line4"]=> NULL ["Line5"]=> NULL ["City"]=> string(14) "Newtown Square" ["Country"]=> NULL ["CountryCode"]=> NULL ["CountrySubDivisionCode"]=> string(2) "PA" ["PostalCode"]=> string(5) "19073" ["PostalCodeSuffix"]=> NULL ["Lat"]=> NULL ["Long"]=> NULL ["Tag"]=> NULL ["Note"]=> NULL } ["ShipAddr"]=> NULL ["OtherAddr"]=> NULL ["ContactName"]=> NULL ["AltContactName"]=> NULL ["Notes"]=> NULL ["Job"]=> string(5) "false" ["BillWithParent"]=> string(5) "false" ["RootCustomerRef"]=> NULL ["ParentRef"]=> NULL ["Level"]=> NULL ["CustomerTypeRef"]=> NULL ["SalesTermRef"]=> string(1) "3" ["SalesRepRef"]=> NULL ["TaxGroupCodeRef"]=> NULL ["TaxRateRef"]=> NULL ["PaymentMethodRef"]=> NULL ["CCDetail"]=> NULL ["PriceLevelRef"]=> NULL ["Balance"]=> string(1) "0" ["OpenBalanceDate"]=> NULL ["BalanceWithJobs"]=> string(6) "182.85" ["CreditLimit"]=> NULL ["AcctNum"]=> NULL ["CurrencyRef"]=> string(3) "USD" ["OverDueBalance"]=> NULL ["TotalRevenue"]=> NULL ["TotalExpense"]=> NULL ["PreferredDeliveryMethod"]=> string(4) "None" ["ResaleNum"]=> NULL ["JobInfo"]=> NULL ["TDSEnabled"]=> NULL ["CustomerEx"]=> NULL ["SecondaryTaxIdentifier"]=> NULL ["ARAccountRef"]=> NULL ["PrimaryTaxIdentifier"]=> NULL ["TaxExemptionReasonId"]=> NULL ["IsProject"]=> string(5) "false" ["BusinessNumber"]=> NULL ["GSTIN"]=> NULL ["GSTRegistrationType"]=> NULL ["IsCISContractor"]=> NULL ["IntuitId"]=> NULL ["Organization"]=> NULL ["Title"]=> NULL ["GivenName"]=> NULL ["MiddleName"]=> NULL ["FamilyName"]=> NULL ["Suffix"]=> NULL ["FullyQualifiedName"]=> string(39) "American National Facilities Management" ["CompanyName"]=> string(39) "Asdfdsfdsft" ["DisplayName"]=> string(39) "Adsfdsfds" ["PrintOnCheckName"]=> string(39) "fgdfghfdjkghfdjkgh" ["UserId"]=> NULL ["Active"]=> string(4) "true" ["PrimaryPhone"]=> object(QuickBooksOnlineAPIDataIPPTelephoneNumber)#88 (9) { ["Id"]=> NULL ["DeviceType"]=> NULL ["CountryCode"]=> NULL ["AreaCode"]=> NULL ["ExchangeCode"]=> NULL ["Extension"]=> NULL ["FreeFormNumber"]=> string(12) "555-555-5555" ["Default"]=> NULL ["Tag"]=> NULL } ["AlternatePhone"]=> NULL ["Mobile"]=> NULL ["Fax"]=> NULL ["PrimaryEmailAddr"]=> object(QuickBooksOnlineAPIDataIPPEmailAddress)#91 (4) { ["Id"]=> NULL ["Address"]=> string(25) "serivice@anfmservices.com" ["Default"]=> NULL ["Tag"]=> NULL } ["WebAddr"]=> NULL ["OtherContactInfo"]=> NULL ["DefaultTaxCodeRef"]=> NULL ["Id"]=> string(4) "1361" ["SyncToken"]=> string(2) "28" ["MetaData"]=> object(QuickBooksOnlineAPIDataIPPModificationMetaData)#87 (6) { ["CreatedByRef"]=> NULL ["CreateTime"]=> string(25) "2016-04-05T08:10:46-07:00" ["LastModifiedByRef"]=> NULL ["LastUpdatedTime"]=> string(25) "2020-02-11T09:08:12-08:00" ["LastChangedInQB"]=> NULL ["Synchronized"]=> NULL } ["CustomField"]=> NULL ["AttachableRef"]=> NULL ["domain"]=> NULL ["status"]=> NULL ["sparse"]=> NULL } } ],
Advertisement
Answer
foreach ($Customer as $object) { echo $object->BillAddr->Line1 . "<br/>"; echo $object->BillAddr->City . "<br/>"; echo $object->SalesTermRef . "<br/>"; }