Solved

Add names to row data in set

Posted on 2014-09-24
11
107 Views
Last Modified: 2014-09-25
i have a unique setup i have an data that has field names in its own listing. i then have data as the names as columns and multiple rows of this set very simaler to a html table with header field names and row data under each col.

how do i join the two together - i have tried array_combine but that seams to work if the field names and data are matching sets i have multiple sets of the second part. how do i join multiple data sets to one row field names list see my output below please
 the code below the first array is my $fields_order_l2 array and the bottom array output is my $queue array i need to make it ONE array with the first array as the array key and the second multi rowed array as the data(values)
i have my field names in $fields_order_l2 and my data in $queue
thank you in advance for any code or help you may provide.
 array(335) {
  [0]=>
  string(4) "A10F"
  [1]=>
  string(4) "A10L"
  [2]=>
  string(4) "A10N"
  [3]=>
  string(4) "A10S"
  [4]=>
  string(4) "A10W"
  [5]=>
  string(3) "A1F"
  [6]=>
  string(3) "A1L"
  [7]=>
  string(3) "A1N"
  [8]=>
  string(3) "A1S"
  [9]=>
  string(3) "A1W"
  [10]=>
  string(3) "A2F"
  [11]=>
  string(3) "A2L"
  [12]=>
  string(3) "A2N"
  [13]=>
  string(3) "A2S"
  [14]=>
  string(3) "A2W"
  [15]=>
  string(3) "A3F"
  [16]=>
  string(3) "A3L"
  [17]=>
  string(3) "A3N"
  [18]=>
  string(3) "A3S"
  [19]=>
  string(3) "A3W"
  [20]=>
  string(3) "A4F"
  [21]=>
  string(3) "A4L"
  [22]=>
  string(3) "A4N"
  [23]=>
  string(3) "A4S"
  [24]=>
  string(3) "A4W"
  [25]=>
  string(3) "A5F"
  [26]=>
  string(3) "A5L"
  [27]=>
  string(3) "A5N"
  [28]=>
  string(3) "A5S"
  [29]=>
  string(3) "A5W"
  [30]=>
  string(3) "A6F"
  [31]=>
  string(3) "A6L"
  [32]=>
  string(3) "A6N"
  [33]=>
  string(3) "A6S"
  [34]=>
  string(3) "A6W"
  [35]=>
  string(3) "A7F"
  [36]=>
  string(3) "A7L"
  [37]=>
  string(3) "A7N"
  [38]=>
  string(3) "A7S"
  [39]=>
  string(3) "A7W"
  [40]=>
  string(3) "A8F"
  [41]=>
  string(3) "A8L"
  [42]=>
  string(3) "A8N"
  [43]=>
  string(3) "A8S"
  [44]=>
  string(3) "A8W"
  [45]=>
  string(3) "A9F"
  [46]=>
  string(3) "A9L"
  [47]=>
  string(3) "A9N"
  [48]=>
  string(3) "A9S"
  [49]=>
  string(3) "A9W"
  [50]=>
  string(3) "AAN"
  [51]=>
  string(3) "ACR"
  [52]=>
  string(16) "ADDITIONAL_ROOMS"
  [53]=>
  string(21) "ADDITIONAL_SALES_INFO"
  [54]=>
  string(3) "ADI"
  [55]=>
  string(3) "AGE"
  [56]=>
  string(12) "AGENTREMARKS"
  [57]=>
  string(3) "AIR"
  [58]=>
  string(22) "ALLOW_COMMENTS_REVIEWS"
  [59]=>
  string(19) "ALT_ELEMENTARY_NAME"
  [60]=>
  string(13) "ALT_HIGH_NAME"
  [61]=>
  string(19) "ALT_JUNIORHIGH_NAME"
  [62]=>
  string(3) "AMN"
  [63]=>
  string(3) "AON"
  [64]=>
  string(3) "APP"
  [65]=>
  string(2) "AR"
  [66]=>
  string(3) "ASF"
  [67]=>
  string(9) "ASFSOURCE"
  [68]=>
  string(3) "ASM"
  [69]=>
  string(3) "ATC"
  [70]=>
  string(8) "ATTDISCL"
  [71]=>
  string(15) "AUCT_PRICE_TYPE"
  [72]=>
  string(12) "AUCTION_DATE"
  [73]=>
  string(3) "AZN"
  [74]=>
  string(3) "B2F"
  [75]=>
  string(3) "B2L"
  [76]=>
  string(3) "B2S"
  [77]=>
  string(3) "B2W"
  [78]=>
  string(3) "B3F"
  [79]=>
  string(3) "B3L"
  [80]=>
  string(3) "B3S"
  [81]=>
  string(3) "B3W"
  [82]=>
  string(3) "B4F"
  [83]=>
  string(3) "B4L"
  [84]=>
  string(3) "B4S"
  [85]=>
  string(3) "B4W"
  [86]=>
  string(3) "B78"
  [87]=>
  string(3) "BAS"
  [88]=>
  string(3) "BAT"
  [89]=>
  string(2) "BB"
  [90]=>
  string(17) "BID_RESERVE_PRICE"
  [91]=>
  string(3) "BLT"
  [92]=>
  string(3) "BMD"
  [93]=>
  string(3) "BMT"
  [94]=>
  string(8) "BOARDNUM"
  [95]=>
  string(2) "BR"
  [96]=>
  string(5) "BRALL"
  [97]=>
  string(7) "BRBELOW"
  [98]=>
  string(3) "BTH"
  [99]=>
  string(3) "C35"
  [100]=>
  string(3) "C57"
  [101]=>
  string(4) "C810"
  [102]=>
  string(4) "CARS"
  [103]=>
  string(2) "CC"
  [104]=>
  string(3) "CIT"
  [105]=>
  string(10) "CLOSEDDATE"
  [106]=>
  string(3) "CNY"
  [107]=>
  string(8) "COLISTER"
  [108]=>
  string(10) "COMPPAIDON"
  [109]=>
  string(12) "CONTRACTDATE"
  [110]=>
  string(10) "CONTTOSHOW"
  [111]=>
  string(2) "CP"
  [112]=>
  string(3) "CRP"
  [113]=>
  string(4) "CTGF"
  [114]=>
  string(15) "CURRENTLYLEASED"
  [115]=>
  string(16) "DEED_GARAGE_COST"
  [116]=>
  string(17) "DEED_PARKING_COST"
  [117]=>
  string(3) "DIM"
  [118]=>
  string(3) "DIN"
  [119]=>
  string(3) "DIR"
  [120]=>
  string(17) "DISABILITY_ACCESS"
  [121]=>
  string(25) "DISABILITY_ACCESS_DETAILS"
  [122]=>
  string(3) "DPR"
  [123]=>
  string(3) "DRF"
  [124]=>
  string(3) "DRL"
  [125]=>
  string(3) "DRS"
  [126]=>
  string(3) "DRV"
  [127]=>
  string(3) "DRW"
  [128]=>
  string(1) "E"
  [129]=>
  string(3) "ELC"
  [130]=>
  string(3) "EQP"
  [131]=>
  string(11) "EXISTING_BF"
  [132]=>
  string(3) "EXP"
  [133]=>
  string(3) "EXT"
  [134]=>
  string(14) "EXT_PROP_FEATS"
  [135]=>
  string(16) "FEE_LEASE_AMOUNT"
  [136]=>
  string(3) "FIN"
  [137]=>
  string(18) "FIREPLACE_LOCATION"
  [138]=>
  string(3) "FND"
  [139]=>
  string(2) "FP"
  [140]=>
  string(3) "FPL"
  [141]=>
  string(15) "FRANCHISOR_FEED"
  [142]=>
  string(4) "FREQ"
  [143]=>
  string(3) "FRF"
  [144]=>
  string(3) "FRL"
  [145]=>
  string(3) "FRS"
  [146]=>
  string(3) "FRW"
  [147]=>
  string(10) "FULL_BATHS"
  [148]=>
  string(3) "GAR"
  [149]=>
  string(13) "GARAGE_ONSITE"
  [150]=>
  string(16) "GARAGE_OWNERSHIP"
  [151]=>
  string(11) "GARAGE_TYPE"
  [152]=>
  string(10) "GREENDISCL"
  [153]=>
  string(9) "GREENFEAT"
  [154]=>
  string(8) "GREENSRC"
  [155]=>
  string(4) "GRID"
  [156]=>
  string(2) "GS"
  [157]=>
  string(3) "GSD"
  [158]=>
  string(10) "HALF_BATHS"
  [159]=>
  string(3) "HEA"
  [160]=>
  string(3) "HEM"
  [161]=>
  string(4) "HERS"
  [162]=>
  string(2) "HS"
  [163]=>
  string(3) "HSD"
  [164]=>
  string(3) "HSN"
  [165]=>
  string(3) "IDX"
  [166]=>
  string(4) "IMPS"
  [167]=>
  string(4) "IMPW"
  [168]=>
  string(3) "INF"
  [169]=>
  string(14) "INT_PROP_FEATS"
  [170]=>
  string(12) "INTERNET_AVM"
  [171]=>
  string(15) "INTERNETLISTING"
  [172]=>
  string(2) "JH"
  [173]=>
  string(3) "JHD"
  [174]=>
  string(3) "KIT"
  [175]=>
  string(3) "KTF"
  [176]=>
  string(3) "KTL"
  [177]=>
  string(3) "KTS"
  [178]=>
  string(3) "KTW"
  [179]=>
  string(10) "LAADDRESS2"
  [180]=>
  string(11) "LACELLPHONE"
  [181]=>
  string(6) "LACITY"
  [182]=>
  string(7) "LAEMAIL"
  [183]=>
  string(11) "LAFAXNUMBER"
  [184]=>
  string(11) "LAFIRSTNAME"
  [185]=>
  string(4) "LAID"
  [186]=>
  string(10) "LALASTNAME"
  [187]=>
  string(13) "LAOFFICEPHONE"
  [188]=>
  string(13) "LAPAGERNUMBER"
  [189]=>
  string(7) "LASTATE"
  [190]=>
  string(12) "LASTREETNAME"
  [191]=>
  string(14) "LASTREETNUMBER"
  [192]=>
  string(3) "LAT"
  [193]=>
  string(8) "LAUNDRYF"
  [194]=>
  string(8) "LAUNDRYL"
  [195]=>
  string(8) "LAUNDRYS"
  [196]=>
  string(8) "LAUNDRYW"
  [197]=>
  string(5) "LAZIP"
  [198]=>
  string(2) "LD"
  [199]=>
  string(3) "LDR"
  [200]=>
  string(3) "LDS"
  [201]=>
  string(7) "LEASEXD"
  [202]=>
  string(4) "LIST"
  [203]=>
  string(3) "LLP"
  [204]=>
  string(3) "LMT"
  [205]=>
  string(2) "LN"
  [206]=>
  string(3) "LNG"
  [207]=>
  string(11) "LO_LOCATION"
  [208]=>
  string(6) "LOCITY"
  [209]=>
  string(7) "LOCKBOX"
  [210]=>
  string(7) "LOEMAIL"
  [211]=>
  string(11) "LOFAXNUMBER"
  [212]=>
  string(4) "LOID"
  [213]=>
  string(6) "LONAME"
  [214]=>
  string(7) "LOPHONE"
  [215]=>
  string(7) "LOSTATE"
  [216]=>
  string(12) "LOSTREETNAME"
  [217]=>
  string(14) "LOSTREETNUMBER"
  [218]=>
  string(5) "LOWWW"
  [219]=>
  string(5) "LOZIP"
  [220]=>
  string(2) "LP"
  [221]=>
  string(3) "LRF"
  [222]=>
  string(3) "LRL"
  [223]=>
  string(3) "LRS"
  [224]=>
  string(3) "LRW"
  [225]=>
  string(3) "LSZ"
  [226]=>
  string(3) "MAI"
  [227]=>
  string(13) "MANAGECOMPANY"
  [228]=>
  string(13) "MANAGECONTACT"
  [229]=>
  string(11) "MANAGEPHONE"
  [230]=>
  string(14) "MANAGINGBROKER"
  [231]=>
  string(16) "MASTER_ASSOC_FEE"
  [232]=>
  string(3) "MBB"
  [233]=>
  string(3) "MBF"
  [234]=>
  string(3) "MBL"
  [235]=>
  string(3) "MBS"
  [236]=>
  string(3) "MBW"
  [237]=>
  string(2) "MC"
  [238]=>
  string(4) "MODx"
  [239]=>
  string(3) "MPN"
  [240]=>
  string(2) "MT"
  [241]=>
  string(1) "N"
  [242]=>
  string(2) "NC"
  [243]=>
  string(3) "NCO"
  [244]=>
  string(16) "NO_GARAGE_SPACES"
  [245]=>
  string(17) "NO_PARKING_SPACES"
  [246]=>
  string(2) "OD"
  [247]=>
  string(3) "OLP"
  [248]=>
  string(3) "OMD"
  [249]=>
  string(3) "OPH"
  [250]=>
  string(3) "OSD"
  [251]=>
  string(2) "OT"
  [252]=>
  string(3) "OWN"
  [253]=>
  string(3) "OWR"
  [254]=>
  string(3) "PAR"
  [255]=>
  string(20) "PAR_FEE_LEASE_AMOUNT"
  [256]=>
  string(14) "PARKING_ONSITE"
  [257]=>
  string(17) "PARKING_OWNERSHIP"
  [258]=>
  string(3) "PHO"
  [259]=>
  string(10) "PHOTOCOUNT"
  [260]=>
  string(9) "PHOTODATE"
  [261]=>
  string(3) "PIN"
  [262]=>
  string(3) "PKN"
  [263]=>
  string(3) "PNT"
  [264]=>
  string(3) "POS"
  [265]=>
  string(14) "POST_DIRECTION"
  [266]=>
  string(13) "RECORDMODDATE"
  [267]=>
  string(7) "REMARKS"
  [268]=>
  string(15) "REMARKSINTERNET"
  [269]=>
  string(3) "TYP"
  [270]=>
  string(3) "RMS"
  [271]=>
  string(3) "ROF"
  [272]=>
  string(2) "RR"
  [273]=>
  string(1) "S"
  [274]=>
  string(10) "SAADDRESS2"
  [275]=>
  string(11) "SACELLPHONE"
  [276]=>
  string(6) "SACITY"
  [277]=>
  string(7) "SAEMAIL"
  [278]=>
  string(11) "SAFAXNUMBER"
  [279]=>
  string(11) "SAFIRSTNAME"
  [280]=>
  string(4) "SAID"
  [281]=>
  string(10) "SALASTNAME"
  [282]=>
  string(12) "SALE_OR_RENT"
  [283]=>
  string(15) "SALE_OR_RENT_LN"
  [284]=>
  string(13) "SAOFFICEPHONE"
  [285]=>
  string(13) "SAPAGERNUMBER"
  [286]=>
  string(3) "SAS"
  [287]=>
  string(7) "SASTATE"
  [288]=>
  string(12) "SASTREETNAME"
  [289]=>
  string(14) "SASTREETNUMBER"
  [290]=>
  string(5) "SAZIP"
  [291]=>
  string(3) "SCI"
  [292]=>
  string(16) "SECURESHOWASSIST"
  [293]=>
  string(11) "SELLERSCONC"
  [294]=>
  string(3) "SHO"
  [295]=>
  string(10) "SHORT_SALE"
  [296]=>
  string(11) "SO_LOCATION"
  [297]=>
  string(6) "SOCITY"
  [298]=>
  string(7) "SOEMAIL"
  [299]=>
  string(11) "SOFAXNUMBER"
  [300]=>
  string(4) "SOID"
  [301]=>
  string(6) "SONAME"
  [302]=>
  string(7) "SOPHONE"
  [303]=>
  string(7) "SOSTATE"
  [304]=>
  string(12) "SOSTREETNAME"
  [305]=>
  string(14) "SOSTREETNUMBER"
  [306]=>
  string(5) "SOWWW"
  [307]=>
  string(5) "SOZIP"
  [308]=>
  string(2) "SP"
  [309]=>
  string(15) "SP_INCL_PARKING"
  [310]=>
  string(13) "SPEC_SVC_AREA"
  [311]=>
  string(12) "SPEC_SVC_FEE"
  [312]=>
  string(2) "ST"
  [313]=>
  string(5) "STATE"
  [314]=>
  string(3) "STD"
  [315]=>
  string(3) "STR"
  [316]=>
  string(12) "STREETSUFFIX"
  [317]=>
  string(3) "STY"
  [318]=>
  string(3) "SUB"
  [319]=>
  string(3) "TAX"
  [320]=>
  string(7) "TOURURL"
  [321]=>
  string(3) "TPE"
  [322]=>
  string(3) "TRM"
  [323]=>
  string(3) "TWN"
  [324]=>
  string(3) "TXC"
  [325]=>
  string(3) "TXY"
  [326]=>
  string(2) "UD"
  [327]=>
  string(13) "VIRTUALPHOTOS"
  [328]=>
  string(2) "VT"
  [329]=>
  string(6) "VTDATE"
  [330]=>
  string(1) "W"
  [331]=>
  string(2) "WF"
  [332]=>
  string(2) "XD"
  [333]=>
  string(2) "ZP"
  [334]=>
  string(3) "ZP4"
}

array(253) {
  [0]=>
  string(2696) ""","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","",".2164","No additional rooms","Short Sale","Yes","31-40 Years","SHORT SALE TO BE APPROVED BY LENDER.","Central Air","N","","","","","No","","Hazel Crest","1350","Landlord/Tenant/Seller","0","","","","","","","Main Level","14X10","","","Main Level","12X10","","","Lower","22X13","","No","Finished","","Yes","","1978","","Full,English","10","4","4","0","2","","","","2","2.5 %","HAZEL CREST","","Cook","","Net Sale Price","","","","HAZEL CREST","","","","","65X166X69X123","","Kedzie to Ridgewood, which is south of 175th, east to Millstone, south to Smoke tree, east to home","No","","Yes","","Main Level","11X11","","","","","","","","Vinyl Siding,Brick","","","","Family Room","","1","","No","Not Applicable","","Lower","25X24","","2","","Yes","Owned","Attached","","","","","","144","0","Forced Air","No","","","228","3106","Y","Sewer-Public","Public","None","","N","All","","144","","","Main Level","12X14","","","","Homewood","perkins0010@aol.com","(708) 748-6307","Denise","607194","Perkins","(773) 870-9082","","IL","Harwood Avenue","18065","41.56377","","Lower","20X11","","60430","2014-08-11T05:00:00","2014-08-13T02:22:35","","","Exclusive Right To Sell","182000","45","08700091","-87.692139","24873","Lynwood","","perkins0010@aol.com","","24873","Impressive Homes Realty, Inc.","(773) 870-9082","IL","Lake Park Drive","2805","","60411","145000","","Main Level","21X14","","Less Than .25 Acre","None","","","","Yes","","Full","","Main Level","18X11","","Active","","","45","","N","","2","","","185000","","","","","Fee Simple","OWNER OF RECORD","","","","","","9","2014-08-13T02:45:49","28363180030000","Garage","","Closing","","2014-09-24T14:47:56","Absolutely Lovely Hazel Crest Short Sale.  4 spacious bedrooms, 2 full baths, updated kitchen with island, dark wood cabinets, granite counter tops, updated baths, beautiful hardwood floors,  lower level features a family room/den with a cozy fire place, laundry room, full bath and the  4th bedroom.  Short sale to be approved.","Yes","Detached Single","8","","Yes","","","","","","","","","","No","","","","N","","","","","Short Sale","","","Text listing agent, evenings after 6 or weekend appointments","","","","","","","","","","","","","","","Yes","N","","Active","Illinois","2014-09-16T05:11:37","Smoke Tree","Court","","","5366","","Split Level","","BREMEN","Homeowner","2012","2014-09-24T14:47:56","No","None","","","No","","60429","""
  [1]=>
  string(3393) ""","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","","No additional rooms","None","Yes","31-40 Years","Lower level fully sealed by Perma-seal.  New heat exchanger being installed in furnace.  Lower level has exit to backyard.  Easy to show.","Central Air","N","","","","Curbs/Gutters,Sidewalks,Street Lights,Street Paved","No","Oven/Range,Microwave,Dishwasher,Refrigerator,Washer,Dryer,Disposal","Buffalo Grove","1274","Assessor","0","","","","","","Carpet","Main Level","10X13","","Carpet","Main Level","10X11","","","Not Applicable","","","Yes","None","","No","","1977","2014-09-24T05:00:00","None","10","3","3","0","2","","","","2","2.5% LESS $200","BUFFALO GROVE","","Lake","86263","Net Sale Price","","","","BUFFALO GROVE","","No","","","60X118X58X125","L-shaped","Milwaukee north of Lake Cook to Chevy Chase Dr., then west 2 blocks to home (fronts on golf course).","No","","Yes","Carpet","Main Level","10X12","Concrete","","","","Humidifier,TV-Cable,CO Detectors,Ceiling Fan,Fan-Whole House,Sump Pump,Air Cleaner","","","Vinyl Siding,Brick","Deck,Porch,Storage Shed","","","Family Room,Living Room","Concrete","2","Attached Fireplace Doors/Screen,Gas Starter","No","Not Applicable","Vinyl","Lower","13X16","","2","Garage Door Opener(s),Transmitter(s)","Yes","Owned","Attached","","","","","TRIPP SCHOOL","102","0","Gas,Forced Air","Yes","","ADLAI E STEVENSON HIGH SCHOOL","125","39","Y","Sewer-Public,Sewer-Storm","Lake Michigan","School Bus Service","1st Floor Bedroom,1st Floor Full Bath","N","All","TRIPP SCHOOL","102","Eating Area-Table Space","Parquet","Main Level","12X12","","","(847) 275-6060","","bill@weichertmckee.com","(847) 634-6510","Bill","86026","O\'Reilly","(847) 275-6060","","IL","","","42.154548645","","Lower","6X10","","","2014-09-08T05:00:00","2014-09-08T15:16:01","Fenced Yard,Golf Course Lot,Landscaped Professionally","","Exclusive Right To Sell","","17","08721876","-87.92037963","8052","Long Grove","","homes@mckeerealestate.com","(847) 634-6510","8052","Weichert Realtors-McKee Real Estate","(847) 634-6500","IL","Old McHenry Rd","145","http://www.mekeerealsetate.com","60047","247500","Carpet","Main Level","15X16","","Less Than .25 Acre","None","","","","No","","None","Carpet","Main Level","12X16","","Active","","","17","20","N","","2","","","247500","","","","","Fee Simple","Owner of Record","","","","","","17","2014-09-08T15:16:01","15353050090000","Garage","","Closing","","2014-09-24T14:57:13","Delightful neighborhood.  Faces the 9th hole of Chevy Chase CC. Current owner has well-maintained the home with newer roof (5 yr), vinyl siding (6 yr), concrete driveway (2 yr), expanded front porch (2 yr), recently painted interior, more.  All appliances stay.  Large deck & fenced yard with shed.","Yes","Detached Single","7","Asphalt/Glass (Shingles)","No","","","","","","","","","","No","","","","N","","","","","None","","","Call Listing Office","","","","","","","","","","","","","","","Yes","N","","Re-activated","Illinois","2014-09-24T14:57:13","Chevy Chase","Drive","Bi-Level","","8077.08","","Split Level","","VERNON","Homeowner","2013","2014-09-24T14:57:13","No","None","","14","No","","60089","""
  [2]=>
  string(2987) ""","Not Applicable","","","","","2nd Level","Other","12X10","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","","Other","REO/Lender Owned","Yes","100+ Years","BUYER IS RESPONSIBLE FOR ANY TRANSFER OR EXEMPT STAMPS.  HUD WILL PAY UP TO 3% SELLING COMMISSION IF ENTERED ON CONTRACT AT TIME OF OFFER. AURORA SSA 134 FOR 2013 IS $19.86 AND INCL IN TAXES  sf PER ASSESSOR IS 927","None","N","","","","Curbs/Gutters,Sidewalks,Street Lights,Street Paved","No","","Aurora / Eola","1176","Landlord/Tenant/Seller","0","","","","","","","2nd Level","12X10","","","","","","","Not Applicable","","","Yes","Unfinished","","No","","1900","","Full","10","2","2","0","2","","","","1","$1.00","AURORA","","Kane","233699","Net Sale Price","2014-09-24T05:00:00","","","AURORA","","No","","","60 X 141","Separate","RT31 (LAKE ST) TO CEDAR W TO HOME","No","","Yes","","Main Level","12X11","Asphalt","","0","Circuit Breakers","","","","Aluminum Siding,Vinyl Siding","Deck","","","","Stone","","","No","Not Applicable","","Not Applicable","","","2","","Yes","Owned","Detached","","","","","HILL ELEMENTARY SCHOOL","129","0","Gas,Forced Air","Yes","","WEST AURORA HIGH SCHOOL","129","412","Y","Sewer-Public","Public","None","","N","All","WASHINGTON MIDDLE SCHOOL","129","Eating Area-Table Space","","Main Level","12X12","","","","Aurora","ana@royanarealty.com","(630) 396-2766","Ana","232524","Wubker","","","IL","W Galena Blvd","943","41.763695","","Not Applicable","","","60506","2014-08-22T05:00:00","2014-08-22T20:22:47","","","Exclusive Right To Sell","","34","08709175","-88.323219","23187","Aurora","","","","23187","Royana Realty, Ltd.","(630) 897-4700","IL","W Galena Blvd","943","","60506","64000","","Main Level","17X12","","Less Than .25 Acre","None","","","","No","","None","","2nd Level","17X9","","Off-Market","","No","34","0","N","","1","","","64000","2014-09-24T05:00:00","","","","Fee Simple","HUD","","","","","","11","2014-08-22T20:22:47","1521232009","Garage","","Closing","","2014-09-24T15:16:19","HUD FORECLOSURE SALE CASE #137-323938  INSURED STATUS:  IE  REPAIR AMOUNT: $5500  PROPERTY TO BE SOLD \"AS IS\".  203K ELIGIBLE.  NO SURVEY PROVIDED.  TAXES PRORATED AT 100%.  EARNEST MONEY MUST BE IN CERTIFIED FUNDS MADE OUT TO ROYANA REALTY, LTD.  LETTER OF APPROVAL OR PROOF OF FUNDS IS REQUIRED.  FOR DETAILS, PRODEDURES AND ELECTRONIC BIDDING INFO SEE HUD HOMESTORE.  EQUAL OPPORTUNITY HOUSING","Yes","Detached Single","5","Asphalt/Glass (Shingles)","No","7","","","","","","","","","No","","","","N","","","","","Variable","","","PLEASE USE SHOWING ASSIST","","","","","","","","","","","","","","","Yes","Y","20","Pending","Illinois","2014-09-24T15:16:19","CEDAR","Street","","","2083.82","","1.5 Story","","AURORA","Homeowner","2013","2014-09-24T15:16:19","No","None","","36","No","","60506","""
  [3]=>
  string(3410) ""","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","","No additional rooms","None","Yes","51-60 Years","Call Tom\'s cell 847-772-0084  Exclude 2nd frig, bar frig and curtains in BR, LR","Central Air","N","","","","Park/Playground,Curbs/Gutters,Sidewalks,Street Lights,Street Paved","No","Oven/Range,Microwave,Dishwasher,Refrigerator,Washer,Dryer,Disposal,All Stainless Steel Kitchen Appliances","Deerfield","2000","Landlord/Tenant/Seller","0","","","","","","Hardwood","2nd Level","13X12","","Hardwood","2nd Level","14X9","","Carpet","Lower","13X9","","Yes","Crawl,Sub-Basement","Double Sink","No","","1955","","Partial","2","4","4","0","2.1","","","","3","2.5% (-) 295","DEERFIELD","","Lake","","Gross Sale Price","","","","DEERFIELD","","No","","","60X140X60X146","Combined w/ LivRm","Waukegan Rd N of Deerfield Rd to Warwick E to Carlisle, N","No","","No","Hardwood","Main Level","13X11","Concrete,Side Drive","","0","Circuit Breakers,100 Amp Service","Humidifier,TV-Cable,Ceiling Fan,Fan-Attic Exhaust,Sump Pump","","","Aluminum Siding,Brick","Deck,Storage Shed","","","","Concrete","","","No","Not Applicable","Carpet","Lower","21X15","","2","Garage Door Opener(s)","Yes","Owned","Attached","","","","","WALDEN ELEMENTARY SCHOOL","109","1","Gas,Forced Air","No","","DEERFIELD HIGH SCHOOL","113","1322","Y","Sewer-Public,Sewer-Storm","Lake Michigan,Public","None","Bar-Dry,Hardwood Floors,In-Law Arrangement","N","All","ALAN B SHEPARD MIDDLE SCHOOL","109","Eating Area-Table Space","Ceramic Tile","Main Level","13X11","","","(847) 772-0084","Bannockburn","Carr.Realty@comcast.net","","Tom","38674","Healy","(847) 772-0084","","IL","Valley Road","1235","42.176937","","Basement","13X11","","60015","2014-08-12T05:00:00","2014-08-12T23:47:08","Fenced Yard","","Exclusive Right To Sell","449000","44","08700010","-87.837341","3012","Bannockburn","","","(847) 945-0996","3012","Carr Realty, Inc","(847) 945-0984","IL","Valley","1235","","60015","439000","Hardwood","Main Level","17X13","","Less Than .25 Acre","None","","","","No","","None","Hardwood","2nd Level","16X11","","Active","","","44","21","N","","1","2","","449000","","","","","Fee Simple","Of Record","Side Apron,Driveway","","Yes","Owned","","12","2014-08-12T23:47:08","16282190030000","Garage,Space/s","","Closing","","2014-09-24T14:47:16","Pristine brick home on quiet street set amongst million + dollar homes in NE Deerfield. New Kitchen w/cherry cab, SS appl & Silestone counters. Large open LR/DR have hdwd floors and picture window. Inviting FR. 3 nice sized BR\'s up w/ceiling fans and hdwd flrs, plus 1 down. Updated baths,nice yard w/deck and shed. Walk to tot lot and award winning school.  Nothing to do but move in an enjoy. New Home Next Door $1M+","Yes","Detached Single","8","Asphalt/Glass (Shingles)","Yes","0","","","","","","","","","No","","","","N","","","","","None","","","Call Tom\'s cell 847-772-0084","","","","","","","","","","","","","","","Yes","N","","Price Change","Illinois","2014-09-24T12:23:36","Carlisle","Place","","NORTHEAST DEERFIELD","9912","","Split Level w/ Sub","","WEST DEERFIELD","Homeowner","2013","2014-09-24T14:47:16","No","None","","10","No","","60015","""

Open in new window

0
Comment
Question by:Johnny
  • 6
  • 5
11 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
Johnny, suggest you scale this down to a smaller set - maybe 3 of the strings in the first array and two in the second array.  Then show us exactly what you want the output data to look like.  It's hard to figure out what you want from the description, but if we can see an example showing where you want the data to go, it should be somewhat easier to show you the code.
0
 

Author Comment

by:Johnny
Comment Utility
[0]
"W"->""
"WF"->"No"
"XD"->""
"ZP"->"60429"
"ZP4"->""
[1]
"W"
"WF"
"XD"
"ZP"
"ZP4"
[2]
"W"
"WF"
"XD"
"ZP"
"ZP4"

Open in new window


the top array is all the field names if it was a mysql pull - the bottom array is the rows of data with data coinciding with the field names for each row.

$dat = array_combine($fields_order_l2, $queue);

Open in new window

array_combine only works with matching first array for keys and second array for values one set i have multiple rows in $queue and ONE row the field names in the first $fields_order_l2 array.

if i do this
$dat = array_combine($fields_order_l2, $queue);
foreach ($dat as $key => $val)
{
    $set .= "'" . $key . "' = '" . $val . "',";
}
$set = rtrim($set, ',');

Open in new window

the queue array has multiple rows it errors and says they dont match (im assuming as it has not one set but multiple sets(rows))

i thought of
for($i=0; $i<count($queue)-1; $i++) {

Open in new window

but i wasnt sure if that would count rows or sets of comma data inside the row. it needs to be how many rows there are. and then how would i use that amount of rows for the loop to get it all to work)
im not to loop the rows to add the field names to each data value in the rows of $queue so i can add a key to each values so i get an  array to build my earlier question of the update ON DUPLICATE KEY UPDATE " . $set
as i do not have a key and values set i have a key as one array $fields_order_l2 and separate rows of data as values in $query

or did i miss something all together?
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
I'm still not sure I understand the question, but maybe something like this could help.  In this example we examine the "keys_row" one-by-one with foreach().  If there is a matching key in the "data_row" we copy the key and value into the "out" array.  Since there is a 1:1 correspondence in this data set, it will not be very exciting to see it run, but if there were extra or missing elements in either array it would look more useful.

<?php // demp/temp_pern.php
error_reporting(E_ALL);

$data_row = array
( "W"   => ""
, "WF"  => "No"
, "XD"  => ""
, "ZP"  => "60429"
, "ZP4" => ""
)
;
$keys_row = array
( "W"
, "WF"
, "XD"
, "ZP"
, "ZP4"
)
;

$out = array();
foreach ($keys_row as $key)
{
    if (array_key_exists($key, $data_row)) $out[$key] = $data_row[$key];
}
print_r($out);

Open in new window

0
 

Author Comment

by:Johnny
Comment Utility
ok lets explain it this way

we have a html table of
cat | dog | date
-----------------------
tan|blk|today
grey|brown|yesterday
white|brown white|aug 4th

i have in array $fields_order_l2 just cat,dog,date
in array $queue i have
[0]
tan,blk,today
[1]
grey,brown,yesterday
[2]
white,brown white,aug 4th

i need an array combined to be (joining my field list{cat,dog,date} and my multiple data rows{tan,blk,today|grey,brown,yesterday| etc})
[0]
cat->tan
dog->blk
date->today
[1]
cat->grey
dog->brown
date->yesterday
[2]
cat->white
dog->brown white
date->aug 4th

so when i do
foreach ($NEW_ARRAY_COMBINED as $key => $val)
{
    $set .= "'" . $key . "' = '" . $val . "',";
}
$set = rtrim($set, ',');

Open in new window

i can use the $set of
`cat`="tan",`dog`="blk",`date`="today" and so forth
for my
ON DUPLICATE KEY UPDATE " . $set values

does this now make sense??? i realize this is not conventional and everyone so far says HUH as mysql returns rows with field names all ready attached but i got this data from rets server as field names in one array and data rows in another. and man its creating problems.. to note im NOT GETTING this FROM mysql server, but am trying to save to a mysql server via insert and on dup update
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
This example uses the most recent test data.  It depends on the positional elements of these arrays.
http://iconoun.com/demo/temp_pern.php

<?php // demp/temp_pern.php
error_reporting(E_ALL);

// SEE http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28524891.html#a40342776

$keys_row = 'cat|dog|date';
$data_rows = array
( 'tan|blk|today'
, 'grey|brown|yesterday'
, 'white|brown white|aug 4th'
)
;

// TURN THE KEYS INTO AN ARRAY
$keys_arr = explode('|', $keys_row);

// ITERATE OVER THE DATA
foreach ($data_rows as $data_row)
{
    // TURN EACH ROW INTO AN ARRAY
    $data_arr = explode('|', $data_row);

    // COMBINE TO SET KEYS
    $new = array_combine($keys_arr, $data_arr);

    // SAVE THIS AS A SUB-ARRAY
    $out[] = $new;
}
echo '<pre>';
print_r($out);

// SHOW HOW TO PROCESS EACH COMBINED ARRAY
foreach ($out as $new)
{
    // WITH EACH SUB-ARRAY
    foreach ($new as $key => $val)
    {
        echo PHP_EOL . "$key POINTS TO $val";
    }
    echo PHP_EOL;
}

Open in new window

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:Johnny
Comment Utility
ok what am i missing here

rows have 335 (what are they called elements

 [0]=>
  string(2696) ""","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","",".2164","No additional rooms","Short Sale","Yes","31-40 Years","SHORT SALE TO BE APPROVED BY LENDER.","Central Air","N","","","","","No","","Hazel Crest","1350","Landlord/Tenant/Seller","0","","","","","","","Main Level","14X10","","","Main Level","12X10","","","Lower","22X13","","No","Finished","","Yes","","1978","","Full,English","10","4","4","0","2","","","","2","2.5 %","HAZEL CREST","","Cook","","Net Sale Price","","","","HAZEL CREST","","","","","65X166X69X123","","Kedzie to Ridgewood, which is south of 175th, east to Millstone, south to Smoke tree, east to home","No","","Yes","","Main Level","11X11","","","","","","","","Vinyl Siding,Brick","","","","Family Room","","1","","No","Not Applicable","","Lower","25X24","","2","","Yes","Owned","Attached","","","","","","144","0","Forced Air","No","","","228","3106","Y","Sewer-Public","Public","None","","N","All","","144","","","Main Level","12X14","","","","Homewood","perkins0010@aol.com","(708) 748-6307","Denise","607194","Perkins","(773) 870-9082","","IL","Harwood Avenue","18065","41.56377","","Lower","20X11","","60430","2014-08-11T05:00:00","2014-08-13T02:22:35","","","Exclusive Right To Sell","182000","45","08700091","-87.692139","24873","Lynwood","","perkins0010@aol.com","","24873","Impressive Homes Realty, Inc.","(773) 870-9082","IL","Lake Park Drive","2805","","60411","145000","","Main Level","21X14","","Less Than .25 Acre","None","","","","Yes","","Full","","Main Level","18X11","","Active","","","45","","N","","2","","","185000","","","","","Fee Simple","OWNER OF RECORD","","","","","","9","2014-08-13T02:45:49","28363180030000","Garage","","Closing","","2014-09-24T14:47:56","Absolutely Lovely Hazel Crest Short Sale.  4 spacious bedrooms, 2 full baths, updated kitchen with island, dark wood cabinets, granite counter tops, updated baths, beautiful hardwood floors,  lower level features a family room/den with a cozy fire place, laundry room, full bath and the  4th bedroom.  Short sale to be approved.","Yes","Detached Single","8","","Yes","","","","","","","","","","No","","","","N","","","","","Short Sale","","","Text listing agent, evenings after 6 or weekend appointments","","","","","","","","","","","","","","","Yes","N","","Active","Illinois","2014-09-16T05:11:37","Smoke Tree","Court","","","5366","","Split Level","","BREMEN","Homeowner","2012","2014-09-24T14:47:56","No","None","","","No","","60429","""

Open in new window


$fields_order_l has array(335) i assume that is elements too for the field names

//$fields_order_l
//$queue
$fields_order_l2 = explode(',', $fields_order_l);
/*
echo "<pre>";
var_dump($fields_order_l2);
echo "</pre><br>";
echo "<pre>";
var_dump($queue);
echo "</pre><br>";
*/


// ITERATE OVER THE DATA
foreach ($queue as $data_row)
{
    // TURN EACH ROW INTO AN ARRAY
    $data_arr = explode(',', $data_row);

    // COMBINE TO SET KEYS
    $new = array_combine($fields_order_l2, $data_arr);

    // SAVE THIS AS A SUB-ARRAY
    $out[] = $new;
}
echo '<pre>';
print_r($out);

// SHOW HOW TO PROCESS EACH COMBINED ARRAY
foreach ($out as $new)
{
    // WITH EACH SUB-ARRAY
    foreach ($new as $key => $val)
    {
        echo PHP_EOL . "$key POINTS TO $val";
    }
    echo PHP_EOL;
}
die('stop');

Open in new window


now im getting an error of
Warning: array_combine(): Both parameters should have an equal number of elements in /home/strange/public_html/......./update_rets_get_all_mysql.php on line 124
line 124 is $new = array_combine($fields_order_l2, $data_arr);

doesn't the new code take $fields_order_l2 and add the key to the values
with
"foreach ($queue as $data_row)"
takes each line of $queue breaks it down to a  loop
"$data_arr = explode(',', $data_row);"
breaks up the line
  string(3124) ""","Not Applicable","","","","Ceramic Tile","Main Level","Foyer","6X4","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","",".1221","Foyer","None","Yes","41-50 Years","Great Rehab! Easy to show & sell! Please send offers to tim@crosstownrealtors.com along w/ contract rider","Central Air","Y","","","","Curbs/Gutters,Street Lights,Street Paved","No","Oven/Range,Microwave,Refrigerator,All Stainless Steel Kitchen Appliances","Dolton","1104","Assessor","0","","","","","","Hardwood","2nd Level","12X10","","Hardwood","2nd Level","10X9","","","Not Applicable","","","Yes","Finished","","Yes","","1969","","Partial","10","3","3","0","2","","","","2","2.5%","DOLTON","","Cook","241561","Net Sale Price","","","","DOLTON","","","","","132X43X132X42","Separate","154th to Blackstone - N to Harper - E to Address","No","","Yes","Hardwood","Main Level","10X9","Concrete,Side Drive","","1","","CO Detectors,Ceiling Fan","","","Vinyl Siding,Brick","Storage Shed","","","","","","","No","Not Applicable","Ceramic Tile","Lower","19X12","","2","","Yes","Owned","Attached","","","","","","149","0","Gas,Forced Air","No","","","205","15204","Y","Sewer-Public","Public","Commuter Bus,Interstate Access","","Y","All","","149","Pantry-Closet","Ceramic Tile","Main Level","10X10","","","(708) 949-4379","Homer Glen","Chris@CrosstownRealtors.com","(708) 887-5502","Chris","226116","Fischer","(708) 949-4379","","IL","","","41.618816","Ceramic Tile","Lower","15X10","","60491","2014-08-11T05:00:00","2014-08-11T20:34:43","","","Exclusive Right To Sell","121900","45","08698643","-87.579887","25888","Homer Glen","","krems22@gmail.com","","25888","Crosstown Realtors, Inc.","(708) 949-4379","IL","W. 143rd St., Unit 103","13161","","60491","119900","Hardwood","Main Level","17X13","","Less Than .25 Acre","None","","","","No","","None","Hardwood","2nd Level","15X10","","Active","","","45","0","N","","2","","","124900","","","","","Fee Simple","OOR","","","","","","16","2014-08-11T20:34:43","29114110360000","Garage","","Closing","","2014-09-24T18:40:38","WOW! BEAUTIFULLY REMODELED 3BED/2BATH TRI-LEVEL W/ LOADS OF UPDATES!  LARGE KITCHEN FEATURES LOADS OF CABINETS & AMPLE COUNTER SPACE, GLASS TILE BACK SPLASH, & STAINLESS STEEL APPLIANCES!  3BEDS ON 2ND LVL W/ GLEAMING HARDWOOD FLOORING & PLENTY OF CLOSET SPACE! 2 FULLY REFINISHED BATHS W/ TILED SHOWERS & MODERN VANITIES! SPACIOUS FAMILY RM IN FINISHED LOWER LVL & LAUNDRY AREA! 2-CAR GARAGE & MUCH MORE!","Yes","Detached Single","7","Asphalt/Glass (Shingles)","Yes","17","","","","","","","","","No","","","","N","","","","","None","","","Click Showing Assist","","","","","","","","","","","","","","","Yes","N","","Price Change","Illinois","2014-09-24T18:40:38","Harper","Avenue","Tri-Level","","4449.33","http://tours.imagemaker360.com/View.asp?ID=133622idx","Split Level","Conventional,FHA,VA","THORNTON","","2013","2014-09-24T18:40:38","No","Image360","2014-08-12T23:00:33","0","No","","60419","""

Open in new window

to one row array
so
"$new = array_combine($fields_order_l2, $data_arr);" can combine it
"$out[] = $new;" makes the new field names and data into a new fancy array

what did i miss??? and where am i going wrong???
with the first post being my actual data im using for $fields_order_l and $queue
0
 

Author Comment

by:Johnny
Comment Utility
confirmation im not nuts
335 rows???
""
"Not Applicable"
""
""
""
"Ceramic Tile"
"Main Level"
"Foyer"
"6X4"
""
""
"Not Applicable"
""
""
""
""
"Not Applicable"
""
""
""
""
"Not Applicable"
""
""
""
""
"Not Applicable"
""
""
""
""
"Not Applicable"
""
""
""
""
"Not Applicable"
""
""
""
""
"Not Applicable"
""
""
""
""
"Not Applicable"
""
""
""
""
".1221"
"Foyer"
"None"
"Yes"
"41-50 Years"
"Great Rehab! Easy to show & sell! Please send offers to tim@crosstownrealtors.com along w/ contract rider"
"Central Air"
"Y"
""
""
""
"Curbs/Gutters,Street Lights,Street Paved"
"No"
"Oven/Range,Microwave,Refrigerator,All Stainless Steel Kitchen Appliances"
"Dolton"
"1104"
"Assessor"
"0"
""
""
""
""
""
"Hardwood"
"2nd Level"
"12X10"
""
"Hardwood"
"2nd Level"
"10X9"
""
""
"Not Applicable"
""
""
"Yes"
"Finished"
""
"Yes"
""
"1969"
""
"Partial"
"10"
"3"
"3"
"0"
"2"
""
""
""
"2"
"2.5%"
"DOLTON"
""
"Cook"
"241561"
"Net Sale Price"
""
""
""
"DOLTON"
""
""
""
""
"132X43X132X42"
"Separate"
"154th to Blackstone - N to Harper - E to Address"
"No"
""
"Yes"
"Hardwood"
"Main Level"
"10X9"
"Concrete,Side Drive"
""
"1"
""
"CO Detectors,Ceiling Fan"
""
""
"Vinyl Siding,Brick"
"Storage Shed"
""
""
""
""
""
""
"No"
"Not Applicable"
"Ceramic Tile"
"Lower"
"19X12"
""
"2"
""
"Yes"
"Owned"
"Attached"
""
""
""
""
""
"149"
"0"
"Gas,Forced Air"
"No"
""
""
"205"
"15204"
"Y"
"Sewer-Public"
"Public"
"Commuter Bus,Interstate Access"
""
"Y"
"All"
""
"149"
"Pantry-Closet"
"Ceramic Tile"
"Main Level"
"10X10"
""
""
"(708) 949-4379"
"Homer Glen"
"Chris@CrosstownRealtors.com"
"(708) 887-5502"
"Chris"
"226116"
"Fischer"
"(708) 949-4379"
""
"IL"
""
""
"41.618816"
"Ceramic Tile"
"Lower"
"15X10"
""
"60491"
"2014-08-11T05:00:00"
"2014-08-11T20:34:43"
""
""
"Exclusive Right To Sell"
"121900"
"45"
"08698643"
"-87.579887"
"25888"
"Homer Glen"
""
"krems22@gmail.com"
""
"25888"
"Crosstown Realtors, Inc."
"(708) 949-4379"
"IL"
"W. 143rd St., Unit 103"
"13161"
""
"60491"
"119900"
"Hardwood"
"Main Level"
"17X13"
""
"Less Than .25 Acre"
"None"
""
""
""
"No"
""
"None"
"Hardwood"
"2nd Level"
"15X10"
""
"Active"
""
""
"45"
"0"
"N"
""
"2"
""
""
"124900"
""
""
""
""
"Fee Simple"
"OOR"
""
""
""
""
""
"16"
"2014-08-11T20:34:43"
"29114110360000"
"Garage"
""
"Closing"
""
"2014-09-24T18:40:38"
"WOW! BEAUTIFULLY REMODELED 3BED/2BATH TRI-LEVEL W/ LOADS OF UPDATES!  LARGE KITCHEN FEATURES LOADS OF CABINETS & AMPLE COUNTER SPACE, GLASS TILE BACK SPLASH, & STAINLESS STEEL APPLIANCES!  3BEDS ON 2ND LVL W/ GLEAMING HARDWOOD FLOORING & PLENTY OF CLOSET SPACE! 2 FULLY REFINISHED BATHS W/ TILED SHOWERS & MODERN VANITIES! SPACIOUS FAMILY RM IN FINISHED LOWER LVL & LAUNDRY AREA! 2-CAR GARAGE & MUCH MORE!"
"Yes"
"Detached Single"
"7"
"Asphalt/Glass (Shingles)"
"Yes"
"17"
""
""
""
""
""
""
""
""
"No"
""
""
""
"N"
""
""
""
""
"None"
""
""
"Click Showing Assist"
""
""
""
""
""
""
""
""
""
""
""
""
""
""
"Yes"
"N"
""
"Price Change"
"Illinois"
"2014-09-24T18:40:38"
"Harper"
"Avenue"
"Tri-Level"
""
"4449.33"
"http://tours.imagemaker360.com/View.asp?ID=133622idx"
"Split Level"
"Conventional,FHA,VA"
"THORNTON"
""
"2013"
"2014-09-24T18:40:38"
"No"
"Image360"
"2014-08-12T23:00:33"
"0"
"No"
""
"60419"
""

Open in new window


array(335) { means i have 335 elements in the array for field names farther confirm [334]=>
  string(3) "ZP4"

so how am i getting an error of "array_combine(): Both parameters should have an equal number of elements"
when my array for field names and array of row data are in sync
HUH???
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
In PHP (and most languages) arrays are numbered from zero, so a three position array looks like this:

[0] => first
[1] => second
[2] => third

This instruction may produce unwanted results if any of the data elements contain commas.  
$data_arr = explode(',', $data_row);

For example, see "Full,English"
You may want to write this string to a file and read it back with fgetcsv().  It's an odd data format.  Too bad they don't have JSON!
0
 

Author Comment

by:Johnny
Comment Utility
@Ray
Ok then - i ran into this problem when i used the first example i found on saving the info using csv files i had to use a pipe for separation then found out there was a pipe in the data, insted of searching for a deliminator, i went to a array to directly save the data to mysql (current code) - this seamed to make the saves a bit faster too.

 with that said how about this.

what tells you how many rows are in an array? (array(253) - from above $queue output)
because wouldnt

for loop $rows the amount of $queue rows
loop for 0 to 334 $cols (as we know there are 335 fields(columns) and that stays constant
{would new need to have a dimension added to it so it made rows too?? as it would have to have rows($queue) with $fields_order_l columns and $queues columns?}
$new = array_combine($fields_order_l[$cols], $queue[$rows][$cols]);
advance loop $cols till done
advance loop $rows till done

now how to do that i am unsure but wouldnt that logic work? Am i correct in my thinking? this way it now eliminates the problem of splitting on comma and uses the all ready built arrays of field names and row data. then that is the NEW array i iterate to build the on duplicate update query for $set= `field_name`="data" etc
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
See if this helps make sense of the data.  Some discussion is in order.  The CSV string here appears to be delimited by double quotes around each data element, so a workable delimiter is not just a comma, but ",".  However, there are no rules for spaces or other whitespace in CSV strings or JSON strings or XML documents when the whitespace occurs outside of the tags and data fields.  This allows you to have nicely formatted documents, but it has the potential to complicate your work.  So it may be be necessary to "scrub" the raw data, perhaps with a regular expression, or to write a state engine that can help normalize the format of the data string.

<?php // demp/temp_pern.php
error_reporting(E_ALL);

// SEE http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28524891.html#a40342991

$str = <<<EOD
"","Not Applicable","","","","Ceramic Tile","Main Level","Foyer","6X4","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","","Not Applicable","","","","",".1221","Foyer","None","Yes","41-50 Years","Great Rehab! Easy to show & sell! Please send offers to tim@crosstownrealtors.com along w/ contract rider","Central Air","Y","","","","Curbs/Gutters,Street Lights,Street Paved","No","Oven/Range,Microwave,Refrigerator,All Stainless Steel Kitchen Appliances","Dolton","1104","Assessor","0","","","","","","Hardwood","2nd Level","12X10","","Hardwood","2nd Level","10X9","","","Not Applicable","","","Yes","Finished","","Yes","","1969","","Partial","10","3","3","0","2","","","","2","2.5%","DOLTON","","Cook","241561","Net Sale Price","","","","DOLTON","","","","","132X43X132X42","Separate","154th to Blackstone - N to Harper - E to Address","No","","Yes","Hardwood","Main Level","10X9","Concrete,Side Drive","","1","","CO Detectors,Ceiling Fan","","","Vinyl Siding,Brick","Storage Shed","","","","","","","No","Not Applicable","Ceramic Tile","Lower","19X12","","2","","Yes","Owned","Attached","","","","","","149","0","Gas,Forced Air","No","","","205","15204","Y","Sewer-Public","Public","Commuter Bus,Interstate Access","","Y","All","","149","Pantry-Closet","Ceramic Tile","Main Level","10X10","","","(708) 949-4379","Homer Glen","Chris@CrosstownRealtors.com","(708) 887-5502","Chris","226116","Fischer","(708) 949-4379","","IL","","","41.618816","Ceramic Tile","Lower","15X10","","60491","2014-08-11T05:00:00","2014-08-11T20:34:43","","","Exclusive Right To Sell","121900","45","08698643","-87.579887","25888","Homer Glen","","krems22@gmail.com","","25888","Crosstown Realtors, Inc.","(708) 949-4379","IL","W. 143rd St., Unit 103","13161","","60491","119900","Hardwood","Main Level","17X13","","Less Than .25 Acre","None","","","","No","","None","Hardwood","2nd Level","15X10","","Active","","","45","0","N","","2","","","124900","","","","","Fee Simple","OOR","","","","","","16","2014-08-11T20:34:43","29114110360000","Garage","","Closing","","2014-09-24T18:40:38","WOW! BEAUTIFULLY REMODELED 3BED/2BATH TRI-LEVEL W/ LOADS OF UPDATES!  LARGE KITCHEN FEATURES LOADS OF CABINETS & AMPLE COUNTER SPACE, GLASS TILE BACK SPLASH, & STAINLESS STEEL APPLIANCES!  3BEDS ON 2ND LVL W/ GLEAMING HARDWOOD FLOORING & PLENTY OF CLOSET SPACE! 2 FULLY REFINISHED BATHS W/ TILED SHOWERS & MODERN VANITIES! SPACIOUS FAMILY RM IN FINISHED LOWER LVL & LAUNDRY AREA! 2-CAR GARAGE & MUCH MORE!","Yes","Detached Single","7","Asphalt/Glass (Shingles)","Yes","17","","","","","","","","","No","","","","N","","","","","None","","","Click Showing Assist","","","","","","","","","","","","","","","Yes","N","","Price Change","Illinois","2014-09-24T18:40:38","Harper","Avenue","Tri-Level","","4449.33","http://tours.imagemaker360.com/View.asp?ID=133622idx","Split Level","Conventional,FHA,VA","THORNTON","","2013","2014-09-24T18:40:38","No","Image360","2014-08-12T23:00:33","0","No","","60419",""
EOD;

$arr = explode(',', $str);
$num = count($arr);
echo PHP_EOL . htmlentities("Explode(',') creates $num array elements");

$arr = explode('","', $str);
$num = count($arr);
echo PHP_EOL . htmlentities("Explode('\",\"') creates $num array elements");

Open in new window

Outputs:
Explode(',') creates 351 array elements
Explode('","') creates 335 array elements
0
 

Author Comment

by:Johnny
Comment Utility
well my long winded explanation came down to how to correctly slit the array.. wow learn something new each day!

Ok getting much farther now.

current code with notes of why it works but does not work ran into new problem
$fields_order_l2 = explode(',', $fields_order_l);

// ITERATE OVER THE DATA
foreach ($queue as $data_row)
{
    // TURN EACH ROW INTO AN ARRAY
    $data_arr = explode('","', $data_row);

    // COMBINE TO SET KEYS
    $new = array_combine($fields_order_l2, $data_arr);

    // SAVE THIS AS A SUB-ARRAY
    $out[] = $new;
}

/// SETTING UP UPDATE QUERY
$set = NULL;
foreach ($out as $new)
{
    // WITH EACH SUB-ARRAY
    foreach ($new as $key => $val)
    {
        //echo PHP_EOL . "$key POINTS TO $val";
        // build fields and values insert into here add to sql_query (for sql file like lines)
        $set .= "`" . $key . "` = '" . $val . "',";
    }
    echo PHP_EOL;
}

$set = rtrim($set, ',');

//have to use out as new loop to make insert into querys as a sql file type output for multible rows
// doe snot work as all of data is in set and all of data is in insert info 9thats fine for insert but not update - need to seperate like sql files do per line query)
$query = "INSERT INTO `".$table."` (".$fields_order_l.") VALUES (" . implode(",",$queue) . ") ON DUPLICATE KEY UPDATE " . $set . "";

				    //$query = "INSERT INTO `".$table."` (".$fields_order_l.") VALUES " . implode(",",$queue);
				        echo $query;
				        die('stop');

Open in new window


i am going to accept this post and move on to next problem

Thank you againg or all your Help Ray always a pleasure
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now