PHP PDO ODBC SELECT returns partial results - php

$db_a = new PDO("odbc:MYOB",'user','pass');
foreach($db_a->query("SELECT * FROM Sale WHERE SaleID = 108605") as $row) {
echo '<pre>';
print_r($row);
echo '</pre>';
}
This returns all the table column titles as well as the first five results but everything after that is blank. I've tried issuing the same select statement through MS access and it works correctly
Array
(
[ItemSaleLineID] => 1605696
[0] => 1605696
[SaleLineID] => 1605696
[1] => 1605696
[SaleID] => 108605
[2] => 108605
[LineNumber] => 1
[3] => 1
[LineTypeID] => D
[4] => D
[Description] =>
[5] =>
[TaxExclusiveTotal] =>
[6] =>
[TaxInclusiveTotal] =>
[7] =>
[TaxCodeID] =>
[8] =>
[JobID] =>
[9] =>
[IsMultipleJob] =>
[10] =>
[Quantity] =>
[11] =>
[ItemID] =>
[12] =>
[TaxExclusiveUnitPrice] =>
[13] =>
[TaxInclusiveUnitPrice] =>
[14] =>
[Discount] =>
[15] =>
[CostOfGoodsSoldAmount] =>
[16] =>
[LocationID] =>
[17] =>
[Kit/ComponentIndicator] =>
[18] =>
)
Output from var_dump:
array(20) { ["SaleLineID"]=> string(7) "1605696" [0]=> string(7) "1605696" ["SaleID"]=> string(6) "108605" [1]=> string(6) "108605" ["LineNumber"]=> string(1) "1" [2]=> string(1) "1" ["LineTypeID"]=> string(1) "D" [3]=> string(1) "D" ["Description"]=> NULL [4]=> NULL ["TaxExclusiveAmount"]=> NULL [5]=> NULL ["TaxInclusiveAmount"]=> NULL [6]=> NULL ["TaxCodeID"]=> NULL [7]=> NULL ["JobID"]=> NULL [8]=> NULL ["IsMultipleJob"]=> NULL [9]=> NULL } array(20) { ["SaleLineID"]=> string(7) "1605697" [0]=> string(7) "1605697" ["SaleID"]=> string(6) "108605" [1]=> string(6) "108605" ["LineNumber"]=> string(1) "2" [2]=> string(1) "2" ["LineTypeID"]=> string(1) "D" [3]=> string(1) "D" ["Description"]=> NULL [4]=> NULL ["TaxExclusiveAmount"]=> NULL [5]=> NULL ["TaxInclusiveAmount"]=> NULL [6]=> NULL ["TaxCodeID"]=> NULL [7]=> NULL ["JobID"]=> NULL [8]=> NULL ["IsMultipleJob"]=> NULL [9]=> NULL } array(20) { ["SaleLineID"]=> string(7) "1605698" [0]=> string(7) "1605698" ["SaleID"]=> string(6) "108605" [1]=> string(6) "108605" ["LineNumber"]=> string(1) "3" [2]=> string(1) "3" ["LineTypeID"]=> string(1) "D" [3]=> string(1) "D" ["Description"]=> NULL [4]=> NULL ["TaxExclusiveAmount"]=> NULL [5]=> NULL ["TaxInclusiveAmount"]=> NULL [6]=> NULL ["TaxCodeID"]=> NULL [7]=> NULL ["JobID"]=> NULL [8]=> NULL ["IsMultipleJob"]=> NULL [9]=> NULL }

Related

Looping Through array from json responce using foreach loop

i called an API and used JSON decode to get array result of the response using the code belodw
<?php
$url = "*******************************";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Authorization: Bearer ************************************N2VlODFjMTkwNg",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close($curl);
$decode = json_decode($resp, true, JSON_UNESCAPED_SLASHES);
var_dump($decode);
?>
My result displays as the code below
array(2) {
["error"] => string(0)
"" ["result"] => array(3) {
["property"] => array(54) {
["PROPERTY_ID"] => string(6)
"253424" ["SALE_RENT"] => string(1)
"S" ["PROP_SUB_TYPE_ID"] => string(1)
"2" ["PROP_TYPE_NAME"] => string(5)
"Konut" ["DISPLAY_NAME"] => string(13)
"Intendox LTD" ["CONTACT_NAME1"] => string(14)
"Stella Istradi" ["PROP_SUB_TYPE_NAME"] => string(5)
"Daire" ["PROP_SUB_TYPE_NAME_EN"] => string(4)
"Flat" ["CITY_NAME"] => string(5)
"Girne" ["TITLE_TYPE_ID"] => string(1)
"1" ["REFERENCE_NO"] => string(0)
"" ["TITLE_NAME"] => string(15)
"Türk Koçanlı" ["CITY_EN"] => string(7)
"Kyrenia" ["CITY_ID"] => string(1)
"2" ["DISTRICT_NAME"] => string(8)
"Alsancak" ["DISTRICT_ID"] => string(1)
"6" ["PROPERTY_NAME"] => string(39)
"2+1NEW FLATS IN ALSANGAK NEAR THE BEACH" ["PROPERTY_NAME_EN"] => string(43)
"2+1NEW FLATS IN ALSANGAK NEAR THE BEACH ** " ["CURRENCY_ICON"] => string(2)
"£" ["CURRENCY_ID"] => string(1)
"1" ["PRICE"] => string(6)
"100000" ["PRICE_FORMATTED"] => string(7)
"100,000" ["STATUS"] => string(1)
"P" ["PRICE_TYPE"] => string(1)
"T" ["FURNISH_STATE"] => string(14)
"Yarı Eşyalı" ["FURNISH_STATE_ID"] => string(1)
"2" ["FREQ_NAME"] => string(6)
"Aylık" ["BEDROOM"] => string(1)
"2" ["BATHROOM"] => string(1)
"1" ["M2"] => string(2)
"84" ["USER_ID"] => string(5)
"14624" ["INSERT_DATE_FORMATTED"] => string(10)
"18/07/2022" ["UPDATE_DATE_FORMATTED"] => string(10)
"28/07/2022" ["TL_PRICE"] => string(12)
"2138800.0000" ["BUILDING_AGE_TEXT"] => string(1)
"0" ["BUILDING_AGE_ID"] => string(2)
"10" ["PROPERTY_DESC"] => string(119)
"FOR SALE NEW APARTMENTS CLOSE TO THE MARMONTE BEACH !!! FIRST FLOOR WITH THE GARDEN SECOND WITH TERRACE AND BARBECUE!!!" ["PROPERTY_DESC_EN"] => string(127)
"FOR SALE NEW APARTMENTS CLOSE TO THE MARMONTE BEACH !!! FIRST FLOOR WITH THE GARDEN SECOND WITH TERRACE AND BARBECUE!!! **AT** " ["SHOW_MAP"] => string(1)
"0" ["PROP_TYPE_ID"] => string(1)
"1" ["GEO_LATITUDE"] => string(0)
"" ["GEO_LONGITUDE"] => string(0)
"" ["ROOM_TYPE_ID"] => string(1)
"3" ["ROOM_TYPE_TEXT"] => string(3)
"2+1" ["SALE_RENT_TEXT"] => string(9)
"Satılık" ["S_R"] => string(1)
"S" ["PROFILE_URL"] => string(12)
"intendox-ltd" ["FLOOR"] => string(1)
"1" ["FLOOR_COUNT"] => string(1)
"2" ["DEVELOPMENT_RATE"] => string(1)
"0" ["FLOOR_PERMISSION"] => string(1)
"0" ["HOUSE_LAND_SIZE"] => string(3)
"250" ["USER_AGENT_ID"] => string(4)
"3188" ["MEMBER_KTEB"] => string(1)
"N"
} ["images"] => array(20) {
[0] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518571" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137613.6374.jpeg" ["FILE_SIZE"] => string(3)
"118" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(1)
"1" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:46:53" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137613.6374.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137613.6374.jpeg"
} [1] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518572" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137615.8337.jpeg" ["FILE_SIZE"] => string(2)
"85" ["IMAGE_DIMENSIONS"] => string(8)
"607x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(1)
"2" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:46:56" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137615.8337.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137615.8337.jpeg"
} [2] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518573" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137618.5905.jpeg" ["FILE_SIZE"] => string(2)
"96" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(1)
"3" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:46:58" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137618.5905.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137618.5905.jpeg"
} [3] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518574" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137621.1575.jpeg" ["FILE_SIZE"] => string(2)
"76" ["IMAGE_DIMENSIONS"] => string(8)
"607x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(1)
"4" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:01" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137621.1575.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137621.1575.jpeg"
} [4] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518575" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137624.0395.jpeg" ["FILE_SIZE"] => string(2)
"92" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(1)
"5" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:04" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137624.0395.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137624.0395.jpeg"
} [5] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518576" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(55)
"girne-alsancak-satilik-daire-253424-1658137626.531.jpeg" ["FILE_SIZE"] => string(3)
"111" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(1)
"6" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:06" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(143)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137626.531.jpeg" ["wm_url"] => string(140)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137626.531.jpeg"
} [6] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518577" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137629.0212.jpeg" ["FILE_SIZE"] => string(3)
"117" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(1)
"7" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:09" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137629.0212.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137629.0212.jpeg"
} [7] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518578" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137631.3465.jpeg" ["FILE_SIZE"] => string(2)
"95" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(1)
"8" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:11" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137631.3465.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137631.3465.jpeg"
} [8] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518579" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137635.3597.jpeg" ["FILE_SIZE"] => string(2)
"93" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(1)
"9" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:16" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137635.3597.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137635.3597.jpeg"
} [9] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518580" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137638.0009.jpeg" ["FILE_SIZE"] => string(3)
"117" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"10" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:18" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137638.0009.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137638.0009.jpeg"
} [10] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518581" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137639.7696.jpeg" ["FILE_SIZE"] => string(2)
"74" ["IMAGE_DIMENSIONS"] => string(8)
"607x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"11" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:19" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137639.7696.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137639.7696.jpeg"
} [11] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518582" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137641.8043.jpeg" ["FILE_SIZE"] => string(2)
"77" ["IMAGE_DIMENSIONS"] => string(8)
"607x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"12" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:22" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137641.8043.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137641.8043.jpeg"
} [12] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518583" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137644.0571.jpeg" ["FILE_SIZE"] => string(3)
"111" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"13" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:24" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137644.0571.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137644.0571.jpeg"
} [13] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518584" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137649.2687.jpeg" ["FILE_SIZE"] => string(3)
"129" ["IMAGE_DIMENSIONS"] => string(8)
"1280x843" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"14" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:29" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137649.2687.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137649.2687.jpeg"
} [14] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518585" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137651.5859.jpeg" ["FILE_SIZE"] => string(2)
"77" ["IMAGE_DIMENSIONS"] => string(8)
"810x1080" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"15" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:31" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137651.5859.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137651.5859.jpeg"
} [15] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518586" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137654.1785.jpeg" ["FILE_SIZE"] => string(3)
"160" ["IMAGE_DIMENSIONS"] => string(8)
"1280x960" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"16" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:34" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137654.1785.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137654.1785.jpeg"
} [16] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518587" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137656.7826.jpeg" ["FILE_SIZE"] => string(3)
"135" ["IMAGE_DIMENSIONS"] => string(8)
"1280x960" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"17" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:37" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137656.7826.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137656.7826.jpeg"
} [17] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518588" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137658.8182.jpeg" ["FILE_SIZE"] => string(3)
"170" ["IMAGE_DIMENSIONS"] => string(8)
"1280x583" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"18" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:39" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137658.8182.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137658.8182.jpeg"
} [18] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518589" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137661.4831.jpeg" ["FILE_SIZE"] => string(3)
"183" ["IMAGE_DIMENSIONS"] => string(8)
"1280x960" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"19" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:41" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137661.4831.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137661.4831.jpeg"
} [19] => array(11) {
["PROP_PICTURE_ID"] => string(7)
"2518590" ["PROPERTY_ID"] => string(6)
"253424" ["PICTURE_PATH"] => string(56)
"girne-alsancak-satilik-daire-253424-1658137663.4862.jpeg" ["FILE_SIZE"] => string(2)
"99" ["IMAGE_DIMENSIONS"] => string(8)
"1280x849" ["THUMBNAIL"] => string(1)
"0" ["ORDER_BY"] => string(2)
"20" ["UPLOAD_DATE"] => string(19)
"2022-07-18 12:47:43" ["REGENERATE_THUMBNAIL"] => string(1)
"0" ["thumb_url"] => string(144)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137663.4862.jpeg" ["wm_url"] => string(141)
"https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137663.4862.jpeg"
}
} ["specifications"] => array(1) {
[0] => array(58) {
["SPEC_ID"] => string(6)
"177052" ["PROPERTY_ID"] => string(6)
"253424" ["BUILTIN_KITCHEN"] => string(1)
"0" ["BALCONY"] => string(1)
"0" ["BATH_CHECK"] => string(1)
"0" ["LAUNDRY"] => string(1)
"0" ["STEEL_DOOR"] => string(1)
"1" ["ENTRYPHONE"] => string(1)
"0" ["NATURAL_MARBLE"] => string(1)
"0" ["SHOWER"] => string(1)
"0" ["WALLPAPER"] => string(1)
"0" ["MASTER_CABINNET"] => string(1)
"0" ["MASTER_BATH"] => string(1)
"0" ["CLOSET"] => string(1)
"0" ["AC"] => string(1)
"0" ["PANEL_DOOR"] => string(1)
"0" ["BLIND"] => string(1)
"0" ["PARQUET"] => string(1)
"0" ["FIREPLACE"] => string(1)
"0" ["TV_INFRASTRUCTURE"] => string(1)
"0" ["VESTIYER"] => string(1)
"0" ["FIRE_ALARM"] => string(1)
"0" ["LIFT"] => string(1)
"0" ["MOUNTAIN_VIEW"] => string(1)
"1" ["SEA_VIEW"] => string(1)
"1" ["SEA_FRONT"] => string(1)
"1" ["WATER_BOOSTER"] => string(1)
"0" ["THERMAL_INSULATION"] => string(1)
"0" ["PARK"] => string(1)
"1" ["WATER_TANK"] => string(1)
"1" ["SECURITY_CAM"] => string(1)
"0" ["CLOSED_PARK"] => string(1)
"0" ["BOUNDING_WALL"] => string(1)
"0" ["GARAGE"] => string(1)
"0" ["TERRACE"] => string(1)
"1" ["GARDEN"] => string(1)
"1" ["PUBLIC_POOL"] => string(1)
"0" ["PRIVATE_POOL"] => string(1)
"1" ["ELECTRICAL_INFRASTRUCTURE"] => string(1)
"0" ["WATER_INFRASTRUCTURE"] => string(1)
"0" ["ROAD"] => string(1)
"0" ["IN_CITY"] => string(1)
"0" ["SU_KUYUSU"] => string(1)
"0" ["CIFT_CAM"] => string(1)
"0" ["SOLAR_ELECTRIC"] => string(1)
"0" ["CITY_VIEW"] => string(1)
"0" ["SARI_TAS"] => string(1)
"0" ["LOFT_SENDE_KAT"] => string(1)
"0" ["KEPENK"] => string(1)
"0" ["BARBEKU"] => string(1)
"1" ["KARTONPIYER"] => string(1)
"0" ["NATURE_VIEW"] => string(1)
"0" ["GENERATOR"] => string(1)
"0" ["PANTRY"] => string(1)
"0" ["NORTH_FACE"] => string(1)
"0" ["SOUTH_FACE"] => string(1)
"0" ["EAST_FACE"] => string(1)
"0" ["WEST_FACE"] => string(1)
"0"
}
}
}
}
i used:
$propertys = array();
foreach ($decode->result as $result) {
foreach ($result->property as $data) {
$property['id'] = $data->PROPERTY_ID;
$property['sale'] = $data->SALE_RENT;
$propertys[] = $property;
}
}
for printing just the property id for a test but for some reason i cant get any of the variable results. i have tried single foreach loop and multiple but cant access the data. any help on how i go about this?
It is objects that can be accessed with the PHP arrow operator (->).
Elements of associative arrays cannot be accessed with the arrow operator.
Try the following:
$data = $decode['result']['property'];
$property['id'] = $data['PROPERTY_ID'];
$property['sale'] = $data['SALE_RENT'];
print_r($property['id']);

Managing two different array in one loop TWIG

i'm new in twig. I had read the twig documentation but can nt find solution, as it is much easier in PHP. ((Trying two array in one loop.))
: i have two arrays one is {{ dump(render_categories) }}--
array(3) {
[0] => array(3) {
[0] => array(2) {
["category_id"] => string(2)
"65" ["name"] => string(11)
"Annivarsary"
} [1] => array(2) {
["category_id"] => string(2)
"67" ["name"] => string(9)
"Christmas"
} [2] => array(2) {
["category_id"] => string(2)
"66" ["name"] => string(8)
"Birthday"
}
} [1] => array(4) {
[0] => array(2) {
["category_id"] => string(2)
"61" ["name"] => string(6)
"Mother"
} [1] => array(2) {
["category_id"] => string(2)
"62" ["name"] => string(6)
"Sister"
} [2] => array(2) {
["category_id"] => string(2)
"60" ["name"] => string(8)
"Daughter"
} [3] => array(2) {
["category_id"] => string(2)
"63" ["name"] => string(10)
"Girlfriend"
}
} [2] => array(5) {
[0] => array(2) {
["category_id"] => string(2)
"73" ["name"] => string(8)
"Earrings"
} [1] => array(2) {
["category_id"] => string(2)
"72" ["name"] => string(22)
"Necklaces&Pendants"
} [2] => array(2) {
["category_id"] => string(2)
"71" ["name"] => string(5)
"Rings"
} [3] => array(2) {
["category_id"] => string(2)
"70" ["name"] => string(9)
"Bracelets"
} [4] => array(2) {
["category_id"] => string(2)
"69" ["name"] => string(6)
"Charms"
}
}
}
Second is {{ dump(load_steps) }} : (of different length)
array(3) {
[0] => array(4) {
["id"] => string(1)
"1" ["category_id"] => string(2)
"64" ["heading"] => string(21)
"What is the occasion?" ["status"] => string(1)
"1"
} [1] => array(4) {
["id"] => string(1)
"2" ["category_id"] => string(2)
"59" ["heading"] => string(5)
"For which Person" ["status"] => string(1)
"1"
} [2] => array(4) {
["id"] => string(1)
"3" ["category_id"] => string(2)
"68" ["heading"] => string(24)
"Type text heading 878787" ["status"] => string(1)
"1"
}
}
I'm trying to get Output like:
What is the occasion? --(get from second array)--
Annivarsary, Christmas, Birthday --(get from First array)--
For which Person? --(get from second array)--
Mother, Sister, Daughter, Girlfriend --(get from First array)--
------So, on-----
Any help is appreciated, ThankYou.
Wouldn't this do the trick ?
{% for key, step in load_steps %}
{{ step['heading'] }}
{% for category in render_categories[key] %}
{{ category['name'] }}
{% endfor %}
{% endfor %}

How to extract from multi dimensional array using codeigniter

How to extract this multi dimensional array from php. I am using codeigniter framework.
array(2) {
[0] => array(14)
{
["Key"] =>
string(48) "32;FaXmBQJ7/0MATwBVAFAAMAAxADIAOA==9;1261414580;"
["Type"] => string(12) "Store_Coupon"
["Code"] => string(8) "COUP0128"
["Coupon_Issuer"] => string(2) "11"
["Coupon_Reference_No"] => string(1) "1"
["Description"] => string(5) "test2"
["Price_Group"] => string(3) "ALL"
["Discount_Type"] => string(15) "Discount_Amount"
["Discount_Value"] => string(1) "0"
["Validation_Period_ID"] => string(2) "14"
["Validation_Description"] => string(15) "2016 membership"
["Starting_Date"] => string(10) "2016-01-01"
["Ending_Date"] => string(10) "2016-12-31"
["Status"] => string(8) "Disabled"
}
[1] => array(14)
{
["Key"] => string(48) "32;FaXmBQJ7/0MATwBVAFAATwBOADAAMg==9;1261413680;"
["Type"] => string(12) "Store_Coupon"
["Code"] => string(8) "COUPON02"
["Coupon_Issuer"] => string(2) "11"
["Coupon_Reference_No"] => string(1) "2"
["Description"] => string(6) "test 3"
["Price_Group"] => string(3) "ALL"
["Discount_Type"] => string(16) "Discount_Percent"
["Discount_Value"] => string(1) "0"
["Validation_Period_ID"] => string(2) "14"
["Validation_Description"] => string(15) "2016 membership"
["Starting_Date"] => string(10) "2016-01-01"
["Ending_Date"] => string(10) "2016-12-31"["Status"] => string(8) "Disabled"
}
}
I want to extract Coupon_Reference_No element. Thanks in advance
Just do a foreach and store that variable in an array. Supposing your aray is $array
$Coupon_Reference_No = array();
foreach($array as $key=>$value){
if($key == 'Coupon_Reference_No'){
$Coupon_Reference_No[] = $value;
}
}
You will get an array $Coupon_Reference_No as array("1","2")

How get array from multidimensional array by order

I have this kind of array:
array(2) {
[1] => array(3) {
[3] => array(3) {
["data"] => array(3) {
["id"] => string(1) "3"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
[4] => array(3) {
["data"] => array(3) {
["id"] => string(1) "4"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
[2] => array(3) {
["data"] => array(3) {
["id"] => string(1) "2"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
}
[2] => &array(3) {
[15] => array(3) {
["data"] => array(3) {
["id"] => string(2) "15"
["depth"] => string(1) "2"
["parent_id"] => string(1) "3"
}
}
[16] => array(3) {
["data"] => array(3) {
["id"] => string(2) "16"
["depth"] => string(1) "2"
["parent_id"] => string(1) "2"
}
}
[18] => array(3) {
["data"] => array(3) {
["id"] => string(2) "18"
["depth"] => string(1) "2"
["parent_id"] => string(1) "4"
}
}
}
}
First level means depth (1 hasn't child, 2 has parent without child, etc.). Order of array items is correct. I need obtain different array in the same order (of course in dependency of level).
array(6) {
[3] => array(3) {
["data"] => array(3) {
["id"] => string(1) "3"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
[15] => array(3) {
["data"] => array(3) {
["id"] => string(1) "15"
["depth"] => string(1) "1"
["parent_id"] => 3
}
}
[4] => array(3) {
["data"] => array(3) {
["id"] => string(1) "4"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
[18] => &array(3) {
["data"] => array(3) {
["id"] => string(2) "18"
["depth"] => string(1) "2"
["parent_id"] => string(1) "4"
}
}
[2] => array(3) {
["data"] => array(3) {
["id"] => string(2) "2"
["depth"] => string(1) "2"
["parent_id"] => NULL
}
}
[16] => array(3) {
["data"] => array(3) {
["id"] => string(2) "16"
["depth"] => string(1) "2"
["parent_id"] => string(1) "2"
}
}
}
**
First solution
**
I found solution but I do not know how make recursion from that. It works only with two levels. Third level is order badly. Variable $this->hierarchicalData contains first array.
$_sortedHierarchyData = array();
foreach ($this->hierarchicalData as $levelKey => $_level) {
foreach ($_level as $itemKey => $item) {
if (isset($this->hierarchicalData[$levelKey + 1])) {
$_sortedHierarchyData[$item['data']['id']] = $item;
$children = $this->searchChildrenFromLevelOfHieararchicalSortedData($item['data']['id'], $this->hierarchicalData[$levelKey + 1]);
$_sortedHierarchyData += $children;
}
}
}
function searchChildrenFromLevelOfHieararchicalSortedData($parent_id, $level)
{
$_children = array();
foreach ($level as $key => $item) {
if ($item['data']['parent_id'] === $parent_id) {
$_children[$key] = $item;
}
}
return $_children;
}

create php array based on another array.

I want to sort all php arrays based on first main array.
This is the main array which I want to use to sort all other arrays:
Array (
[0] => 10
[1] => 14
[2] => 15
[3] => 20
[4] => 21
[5] => 24
[6] => 25
[7] => 28
[8] => 30
[9] => 45
[10] => 60
[11] => 90
[12] => 120
[13] => 150
[14] => 180
[15] => 210
[16] => 240
[17] => 270
[18] => 365
)
This are arrays which need to be sorted :
Array (
[0] => Array
(
[14] => 49.21
[20] => 71.04
[25] => 89.58
[30] => 100.00
)
[1] => Array
(
[180] => 412.00
[150] => 347.00
[120] => 285.00
[90] => 224.00
[60] => 165.00
[30] => 100.00
[14] => 47.00
)
)
I need that final result look like this:
Array (
[0] => Array
(
[10] => n/a
[14] => 49.21
[15] => n/a
[20] => 71.04
[21] => n/a
[24] => n/a
[25] => 89.58
[28] => n/a
[30] => 100.00
[45] => n/a
[60] => n/a
[90] => n/a
[120] => n/a
[150] => n/a
[180] => n/a
[210] => n/a
[240] => n/a
[270] => n/a
[365] => n/a
)
[1] => Array
(
[10] => n/a
[14] => 71.04
[15] => n/a
[20] => n/a
[21] => n/a
[24] => n/a
[25] => n/a
[28] => n/a
[30] => 100.00
[45] => n/a
[60] => 165.00
[90] => 224.00
[120] => 285.00
[150] => 347.00
[180] => 412.00
[210] => n/a
[240] => n/a
[270] => n/a
[365] => n/a
)
)
Thanks.
Assuming your initial array is $source, and $todo is your second array with the two subsets, then:
$keys = array_flip($todo);
$keys = array_map(function() { return 'n/a'; }, $keys); // set all values to be "n/a";
foreach($todo as $idx => $do) {
$todo[$idx] = $do + $keys; // merge without renumbering.
}
If I understand it right from your question, you want to make both arrays of the same length and set keys not in them to "n/a".
Variant with array_merge (Demo):
$shorten = array(
0 => 10,
1 => 14,
2 => 15,
3 => 20,
4 => 21,
5 => 24,
6 => 25,
7 => 28,
8 => 30,
9 => 45,
10 => 60,
11 => 90,
12 => 120,
13 => 150,
14 => 180,
15 => 210,
16 => 240,
17 => 270,
18 => 365,
);
$data = array(
0 => array(
14 => '49.21',
20 => '71.04',
25 => '89.58',
30 => '100.00',
),
1 => array(
180 => '412.00',
150 => '347.00',
120 => '285.00',
90 => '224.00',
60 => '165.00',
30 => '100.00',
14 => '47.00',
),
);
// default array as the base
$shorten = array_combine($shorten, array_fill(0, count($shorten), 'n/a'));
foreach($data as &$array) {
// merge to get set members
$array = array_merge($shorten, $array);
}
unset($array);
var_dump($data);
Result:
array(2) {
[0]=>
array(23) {
[0]=>
string(3) "n/a"
[1]=>
string(3) "n/a"
[2]=>
string(3) "n/a"
[3]=>
string(3) "n/a"
[4]=>
string(3) "n/a"
[5]=>
string(3) "n/a"
[6]=>
string(3) "n/a"
[7]=>
string(3) "n/a"
[8]=>
string(3) "n/a"
[9]=>
string(3) "n/a"
[10]=>
string(3) "n/a"
[11]=>
string(3) "n/a"
[12]=>
string(3) "n/a"
[13]=>
string(3) "n/a"
[14]=>
string(3) "n/a"
[15]=>
string(3) "n/a"
[16]=>
string(3) "n/a"
[17]=>
string(3) "n/a"
[18]=>
string(3) "n/a"
[19]=>
string(5) "49.21"
[20]=>
string(5) "71.04"
[21]=>
string(5) "89.58"
[22]=>
string(6) "100.00"
}
[1]=>
array(26) {
[0]=>
string(3) "n/a"
[1]=>
string(3) "n/a"
[2]=>
string(3) "n/a"
[3]=>
string(3) "n/a"
[4]=>
string(3) "n/a"
[5]=>
string(3) "n/a"
[6]=>
string(3) "n/a"
[7]=>
string(3) "n/a"
[8]=>
string(3) "n/a"
[9]=>
string(3) "n/a"
[10]=>
string(3) "n/a"
[11]=>
string(3) "n/a"
[12]=>
string(3) "n/a"
[13]=>
string(3) "n/a"
[14]=>
string(3) "n/a"
[15]=>
string(3) "n/a"
[16]=>
string(3) "n/a"
[17]=>
string(3) "n/a"
[18]=>
string(3) "n/a"
[19]=>
string(6) "412.00"
[20]=>
string(6) "347.00"
[21]=>
string(6) "285.00"
[22]=>
string(6) "224.00"
[23]=>
string(6) "165.00"
[24]=>
string(6) "100.00"
[25]=>
string(5) "47.00"
}
}
Variant with mapping function (Demo):
$shorten = array(
0 => 10,
1 => 14,
2 => 15,
3 => 20,
4 => 21,
5 => 24,
6 => 25,
7 => 28,
8 => 30,
9 => 45,
10 => 60,
11 => 90,
12 => 120,
13 => 150,
14 => 180,
15 => 210,
16 => 240,
17 => 270,
18 => 365,
);
// overload $shorten array with a mapping function
$shorten = function(array $a) use ($shorten)
{
$r = array();
foreach($shorten as $i => $k)
{
$r[$k] = isset($a[$k]) ? $a[$k] : 'n/a';
}
return $r;
};
$data = array(
0 => array(
14 => '49.21',
20 => '71.04',
25 => '89.58',
30 => '100.00',
),
1 => array(
180 => '412.00',
150 => '347.00',
120 => '285.00',
90 => '224.00',
60 => '165.00',
30 => '100.00',
14 => '47.00',
),
);
// apply mapping function to $data
$data = array_map($shorten, $data);
var_dump($data); # result
Result:
array(2) {
[0]=>
array(19) {
[10]=>
string(3) "n/a"
[14]=>
string(5) "49.21"
[15]=>
string(3) "n/a"
[20]=>
string(5) "71.04"
[21]=>
string(3) "n/a"
[24]=>
string(3) "n/a"
[25]=>
string(5) "89.58"
[28]=>
string(3) "n/a"
[30]=>
string(6) "100.00"
[45]=>
string(3) "n/a"
[60]=>
string(3) "n/a"
[90]=>
string(3) "n/a"
[120]=>
string(3) "n/a"
[150]=>
string(3) "n/a"
[180]=>
string(3) "n/a"
[210]=>
string(3) "n/a"
[240]=>
string(3) "n/a"
[270]=>
string(3) "n/a"
[365]=>
string(3) "n/a"
}
[1]=>
array(19) {
[10]=>
string(3) "n/a"
[14]=>
string(5) "47.00"
[15]=>
string(3) "n/a"
[20]=>
string(3) "n/a"
[21]=>
string(3) "n/a"
[24]=>
string(3) "n/a"
[25]=>
string(3) "n/a"
[28]=>
string(3) "n/a"
[30]=>
string(6) "100.00"
[45]=>
string(3) "n/a"
[60]=>
string(6) "165.00"
[90]=>
string(6) "224.00"
[120]=>
string(6) "285.00"
[150]=>
string(6) "347.00"
[180]=>
string(6) "412.00"
[210]=>
string(3) "n/a"
[240]=>
string(3) "n/a"
[270]=>
string(3) "n/a"
[365]=>
string(3) "n/a"
}
}

Categories