Jump to content

Greywacke

Members
  • Posts

    510
  • Joined

  • Last visited

Everything posted by Greywacke

  1. i guess this can be done as follows: for (var i = 0; i < arr.length; i++) { if (arr[i] instanceof Array) { for (var j = 0; j < arr[i].length; j++) { if (arr[i][j] instanceof Array) { arr[i][j] = rr[i][j].join(";;"); } } arr[i] = arr[i].join(";;;"); } } var val = arr.join(";;;;"); but i am wondering now... could a generic function be written to do this, and if so how would one collapse a multidimentional javascript array of any depth down to a string, retaining all the values and the scope? i.e. possibly loop each dimention level it goes into untill no more dimention levels... :)unfortunately i can't seem to find anything available on the net regarding this specifically, except for a PHP function that apparently does something like this for JSON (json_convert, but the source code is not available to inspect...).just performing a join on the root array of a multidimentional array does not retain the subarray values, unfortunately...
  2. hi all,struggling slightly to wrap my head around this. sofar i've got the method, which would be as follows: for (i = 0; i < arr.length; i++) { if (arr[i] instanceof Array) { arr[i] = arr[i].join(";;;"); } } var val = arr.join(";;"); now i understand that this is 2 levels of arrays and i need to collapse 3, some elements not being arrays.the array passed as arr, is somewhat as follows - the new lines and groups of new lines denote a level 1 element.|- denotes the start of a subarray, |_ denotes the end of a subarray.the groups are level 2 and the groups within the groups are at level 3.eg. 11Category A20|- 351| budget| disabled| |- 527| |_ 10,000| |- 397| | 10,000|_ |_ 1 the 3rd level arrays with 3 number/string elements are for a selected attribute value and it's properties, the third property is the combination of attributes they belong to.the 3rd level arrays with 2 number/string elements are for an available attribute value and it's properties.the 2nd level number/string elements that are not an array are the attribute key properties, and the 1st level number/string elements are properties of the category. an example of the xml looks as follows: <pricecat> <catid>1</catid> <svcid>1</svcid> <catdesc>Category A</catdesc> <catprice>20</catprice> <catgroup id="531" desc="Budget" disabled="disabled"> <availattrval id="527" value="R10,000 to R12,500" /> <availattrval id="526" value="R12,500 plus" /> <availattrval id="531" value="R3,000 to R4,000" /> <availattrval id="530" value="R4,000 to R5,000" /> <availattrval id="529" value="R5,000 to R7,500" /> <availattrval id="528" value="R7,500 to R10,000" /> </catgroup> <catgroup id="525" desc="Fitment" disabled="disabled"> <availattrval id="520" value="ASAP" /> <availattrval id="525" value="Not within the next 3 months" /> <availattrval id="523" value="Within the next 2 months" /> <availattrval id="521" value="Within the next 2 weeks" /> <availattrval id="524" value="Within the next 3 months" /> <availattrval id="522" value="Within the next month" /> </catgroup> <catgroup id="286" desc="Requirement" disabled="disabled"> <availattrval id="289" value="New - Colour-coded" /> <availattrval id="288" value="New - White" /> <availattrval id="287" value="Pre-owned - Colour-coded" /> <availattrval id="286" value="Pre-owned - White" /> </catgroup> <catgroup id="393" desc="budget" disabled="disabled"> <availattrval id="397" value="R10,000 to R12,500" /> <availattrval id="398" value="R12,500 plus" /> <availattrval id="393" value="R3,000 to R4,000" /> <availattrval id="394" value="R4,000 to R5,000" /> <availattrval id="395" value="R5,000 to R7,500" /> <availattrval id="396" value="R7,500 to R10,000" /> <validattrval id="397" value="R10,000 to R12,500" combo="1" /> </catgroup> <catgroup id="1" desc="canopy_req" disabled="disabled"> <availattrval id="2" value="new_colour_coded" /> <availattrval id="1" value="new_white" /> <availattrval id="12" value="pre-owned_colour_coded" /> <availattrval id="11" value="pre-owned_white" /> <validattrval id="1" value="new_white" combo="1" /> </catgroup> <catgroup id="519" desc="fitment" disabled="disabled"> <availattrval id="514" value="ASAP" /> <availattrval id="519" value="not_within_3_months" /> <availattrval id="517" value="within_2_months" /> <availattrval id="515" value="within_2_weeks" /> <availattrval id="518" value="within_3_months" /> <availattrval id="516" value="within_month" /> </catgroup> </pricecat> they are successfully retrieved into a 3 level array as the example in the second codebox.i am struggling to wrap my head around parsing this array though... could somebody give me some assistance/advice (even if it's "not what i want to hear") please?
  3. ossum - well i've located the problem the variable val was used to store the attribute values along with the keys in the check for val[4] :)issue resolved :)justsomeguy, i unfortunately have not yet been granted the time though, to figure out firebug and how to use it (ie which buttons do what etc)...
  4. hi again,the proof mentioned in the topic is the bold line of the script, the function at the bottom of the post.i've got an array that notifies as the following when joined with "\n\n":this is the function that is supposed to parse these option values which are joined arrays: // onselect event handlerdocument.form_services.list_services.onchange = function () { service = this.selectedIndex; if (service > -1) { var val = this.options[this.selectedIndex].value.split("|;|"); [b]//salert(val.join("\n\n"));[/b] document.getElementById("text_serviceid").value = val[0]; document.getElementById("text_servicedescription").value = ltrim(this.options[this.selectedIndex].text,""); document.getElementById("text_costperlead").value = val[1]; document.getElementById("text_duplicatedays").value = val[2]; document.getElementById("checkbox_showdetails").checked = Boolean(parseInt(val[3])) if (val[4]) { var a = val[4].split(";.;"); var key = ""; var val = 0; for (var i = 0; i < a.length; i++) { var aa = a[i].split(";;;"); //salert(aa); if (key != aa[1]) { val = aa[0]; key = aa[1]; var opt2 = document.createElement("option"); opt2.text = key + " Attribute Key"; opt2.value = val; var sel2 = document. getElementById("menu_attributekeys"); try { sel2.add(opt2, null); // standards compliant: // doesn't work in IE } catch(ex) { sel2.add(opt2); // IE only } } var opt1 = document.createElement("option"); opt1.text = aa[1] + " != " + aa[2]; opt1.value = aa[0]; var sel1 = document. getElementById("list_serviceattributes"); try { sel1.add(opt1, null); // standards compliant: // doesn't work in IE } catch(ex) { sel1.add(opt1); // IE only } } } if (val[5]) { var s = val[5].split(";.;"); for (var i = 0; i < s.length; i++) { var ss = s[i].split(";;;"); //salert(ss); var opt = document.createElement("option"); opt.text = ss[1] + " (" + ss[3] + " and children)"; opt.value = ss[0] + "|;|" + ss[2]; var sel = document. getElementById("list_servicesuppliers"); try { sel.add(opt, null); // standards compliant: // doesn't work in IE } catch(ex) { sel.add(opt); // IE only } } } if (val[6]) { var w = val[6].split(";.;"); for (var i = 0; i < w.length; i++) { var sw = w[i].split(";;;"); //salert(ww); var opt = document.createElement("option"); opt.text = sw[1] + " (" + sw[2] + " suppliers wanted)"; opt.value = sw[0] + "|;|" + sw[2]; var sel = document.getElementById("list_supplierswanted"); try { sel.add(opt, null); // standards compliant: // doesn't work in IE } catch(ex) { sel.add(opt); // IE only } } } if (val[7]) { alert(val[7]); var k = val[7].split(";.;"); for (var i = 0; i < p.length; i++) { var ka = k[i].split(";;;"); alert(ka); var opt = document.createElement("option"); opt.text = ka[1] + " Attribute Values"; opt.value = ka[0]; var sel = document.getElementById("list_attributekeys"); try { sel.add(opt, null); // standards compliant: // doesn't work in IE } catch(ex) { sel.add(opt); // IE only } } } }} here follows the option value split to an array, joined by \n\n as notified by the custom salert function. 120301393;;;budget;;;R3,000 to R4,000;.;394;;;budget;;;R4,000 to R5,000;.;395;;;budget;;;R5,000 to R7,500;.;396;;;budget;;;R7,500 to R10,000;.;397;;;budget;;;R10,000 to R12,500;.;398;;;budget;;;R12,500 plus;.;1;;;canopy_req;;;new_white;.;2;;;canopy_req;;;new_colour_coded;.;11;;;canopy_req;;;pre-owned_white;.;12;;;canopy_req;;;pre-owned_colour_coded;.;400;;;canopy_style;;;spacesaver;.;306;;;products_description;;;Meiya;.;401;;;products_description;;;Single;.;402;;;products_description;;;Asiawing;.;403;;;products_description;;;Chana;.;405;;;products_description;;;Fiat;.;406;;;products_description;;;DFM;.;407;;;products_description;;;Kia;.;423;;;products_description;;;Hyundai;.;432;;;products_description;;;CAM;.;433;;;products_description;;;CAM Leo;.;434;;;products_description;;;CAM Leo D/C;.;435;;;products_description;;;CAM Leo Single;.;436;;;products_description;;;CAM Rhino;.;437;;;products_description;;;CAM Rhino D/C;.;438;;;products_description;;;CAM Rhino Single;.;439;;;products_description;;;Chana Star;.;440;;;products_description;;;Chana Star D/C;.;441;;;products_description;;;Chana Star Club;.;442;;;products_description;;;Chana Star Single;.;443;;;products_description;;;Isuzu LWB;.;444;;;products_description;;;Isuzu D/C;.;445;;;products_description;;;Isuzu Ext/C;.;446;;;products_description;;;GWM LWB;.;447;;;products_description;;;GWM Steed;.;448;;;products_description;;;GWM;.;449;;;products_description;;;Isuzu;.;450;;;products_description;;;GWM D/C;.;451;;;products_description;;;GONOW;.;452;;;products_description;;;GONOW Single;.;453;;;products_description;;;GONOW D/C;.;454;;;products_description;;;Ford Bantam;.;455;;;products_description;;;Ford;.;456;;;products_description;;;Ford D/C;.;457;;;products_description;;;Ford S/C;.;458;;;products_description;;;Ford LWB;.;459;;;products_description;;;Fiat Strada X-Space;.;460;;;products_description;;;Fiat Strada;.;461;;;products_description;;;Volkswagen Transporter;.;462;;;products_description;;;Volkswagen;.;463;;;products_description;;;Volkswagen Caddy;.;464;;;products_description;;;Mahindra Bolero Pickup;.;465;;;products_description;;;Mahindra Bolero;.;466;;;products_description;;;Mahindra;.;467;;;products_description;;;Mahindra Bolero D/C;.;468;;;products_description;;;Mahindra Scorpio Pickup;.;469;;;products_description;;;Mahindra Scorpio;.;470;;;products_description;;;Mahindra Scorpio D/C;.;471;;;products_description;;;Mazda LWB;.;472;;;products_description;;;Mazda;.;473;;;products_description;;;Mazda D/C;.;474;;;products_description;;;Meiya Single;.;475;;;products_description;;;Meiya D/C;.;476;;;products_description;;;Mitsubishi;.;477;;;products_description;;;Mitsubishi LWB;.;478;;;products_description;;;Mitsubishi Triton D/C;.;479;;;products_description;;;Mitsubishi Triton;.;480;;;products_description;;;Mitsubishi Triton C/C;.;481;;;products_description;;;Mitsubishi D/C;.;482;;;products_description;;;Mitsubishi C/C;.;483;;;products_description;;;Nissan LWB;.;484;;;products_description;;;Nissan Navara;.;485;;;products_description;;;Nissan D/C;.;486;;;products_description;;;Nissan K/C;.;487;;;products_description;;;Nissan NP200;.;488;;;products_description;;;Nissan;.;489;;;products_description;;;Nissan 1400;.;490;;;products_description;;;Opel Corsa;.;491;;;products_description;;;Toyota L/C;.;492;;;products_description;;;Toyota;.;493;;;products_description;;;Toyota D/C;.;494;;;products_description;;;Toyota LWB;.;495;;;products_description;;;Toyota SWB;.;496;;;products_description;;;Tata;.;497;;;products_description;;;Tata SWB;.;498;;;products_description;;;Tata Xenon D/C;.;499;;;products_description;;;Tata Xenon SWB;.;500;;;products_description;;;Tata D/C;.;501;;;products_description;;;Tata Xenon;.;502;;;products_description;;;Soyat;.;503;;;products_description;;;Soyat Junda Single;.;504;;;products_description;;;Soyat Junda D/C;.;505;;;products_description;;;Spacesaver;.;506;;;products_description;;;LWB;.;507;;;products_description;;;SWB;.;508;;;products_description;;;D/C;.;509;;;products_description;;;K/C;.;510;;;products_description;;;S/C;.;511;;;products_description;;;X Space;.;512;;;products_description;;;SCAB;.;513;;;products_description;;;Ext/C;.;286;;;Requirement;;;Pre-owned - White;.;287;;;Requirement;;;Pre-owned - Colour-coded;.;288;;;Requirement;;;New - White;.;289;;;Requirement;;;New - Colour-coded;.;307;;;vehicle_make_model;;;Meiya;.;308;;;vehicle_make_model;;;Asiawing;.;309;;;vehicle_make_model;;;Chana;.;371;;;vehicle_make_model;;;Ford - F250;.;370;;;vehicle_make_model;;;Fiat;.;312;;;vehicle_make_model;;;DFM;.;313;;;vehicle_make_model;;;Kia;.;314;;;vehicle_make_model;;;Fiat - Strada;.;315;;;vehicle_make_model;;;Fiat - Strada X Space;.;316;;;vehicle_make_model;;;Ford - F250 LWB;.;317;;;vehicle_make_model;;;Ford - F250 DCAB;.;318;;;vehicle_make_model;;;Ford - LWB;.;319;;;vehicle_make_model;;;Ford - SCAB;.;320;;;vehicle_make_model;;;Ford - DCAB;.;321;;;vehicle_make_model;;;Ford - Bantam;.;322;;;vehicle_make_model;;;Gonow - LWB;.;323;;;vehicle_make_model;;;Gonow - SCAB;.;324;;;vehicle_make_model;;;Gonow - DCAB;.;325;;;vehicle_make_model;;;Gonow - DCAB LWB;.;326;;;vehicle_make_model;;;GMW - LWB;.;327;;;vehicle_make_model;;;GWM - DCAB;.;328;;;vehicle_make_model;;;GWM - Steed DCAB;.;329;;;vehicle_make_model;;;Hyundai;.;330;;;vehicle_make_model;;;Isuzu - LWB;.;331;;;vehicle_make_model;;;Isuzu - SCAB;.;332;;;vehicle_make_model;;;Isuzu - DCAB;.;333;;;vehicle_make_model;;;Mahindra - Scorpio LWB;.;334;;;vehicle_make_model;;;Mahindra - Scorpio DCAB;.;335;;;vehicle_make_model;;;Mahindra - Bolero LWB;.;336;;;vehicle_make_model;;;Mahindra - Bolero DCAB;.;337;;;vehicle_make_model;;;Mazda - LWB;.;338;;;vehicle_make_model;;;Mazda - DCAB;.;339;;;vehicle_make_model;;;Mazda - Rustler;.;340;;;vehicle_make_model;;;Meiya - LWB;.;341;;;vehicle_make_model;;;Meiya - DCAB;.;342;;;vehicle_make_model;;;Mitsubishi - LWB;.;343;;;vehicle_make_model;;;Mitsubishi - CCAB;.;344;;;vehicle_make_model;;;Mitsubishi - DCAB;.;345;;;vehicle_make_model;;;Mitsubishi - Triton DCAB;.;346;;;vehicle_make_model;;;Mitsubishi - Triton CCAB;.;347;;;vehicle_make_model;;;Nissan - 1400;.;348;;;vehicle_make_model;;;Nissan - NP200;.;349;;;vehicle_make_model;;;Nissan - SWB;.;350;;;vehicle_make_model;;;Nissan - LWB;.;351;;;vehicle_make_model;;;Nissan - KCAB;.;352;;;vehicle_make_model;;;Nissan - DCAB;.;353;;;vehicle_make_model;;;Nissan - Navara;.;354;;;vehicle_make_model;;;Nissan - Patrol;.;355;;;vehicle_make_model;;;Opel - Corsa;.;356;;;vehicle_make_model;;;Proton - Arena;.;357;;;vehicle_make_model;;;Ssangyong - Musso DCAB;.;358;;;vehicle_make_model;;;Soyat - Junda LWB;.;359;;;vehicle_make_model;;;Soyat - Junda DCAB;.;360;;;vehicle_make_model;;;Tata - Telcoline LWB;.;361;;;vehicle_make_model;;;Tata - Telcoline DCAB;.;362;;;vehicle_make_model;;;Tata - Xenon DCAB;.;363;;;vehicle_make_model;;;Tata - Xenon LWB;.;364;;;vehicle_make_model;;;Toyota - SWB;.;365;;;vehicle_make_model;;;Toyota - LWB;.;366;;;vehicle_make_model;;;Toyota - DCAB;.;367;;;vehicle_make_model;;;Toyota - L/Cruiser;.;368;;;vehicle_make_model;;;Volkswagen - 1600;.;369;;;vehicle_make_model;;;Volkswagen - Transporter;.;372;;;vehicle_make_model;;;Gonow;.;373;;;vehicle_make_model;;;GMW;.;374;;;vehicle_make_model;;;Mahindra;.;375;;;vehicle_make_model;;;Mahindra - Scorpio;.;376;;;vehicle_make_model;;;Mahindra - Bolero;.;377;;;vehicle_make_model;;;Mitsubishi - Triton;.;378;;;vehicle_make_model;;;Tata - Xenon;.;379;;;vehicle_make_model;;;SWB;.;380;;;vehicle_make_model;;;LWB;.;381;;;vehicle_make_model;;;DCAB;.;382;;;vehicle_make_model;;;X Space;.;383;;;vehicle_make_model;;;SCAB;.;384;;;vehicle_make_model;;;CCAB;.;385;;;vehicle_make_model;;;KCAB;.;386;;;vehicle_make_model;;;Tata - Telcoline;.;387;;;vehicle_make_model;;;L/Cruiser;.;388;;;vehicle_make_model;;;Soyat;.;389;;;vehicle_make_model;;;Mitsubishi;.;390;;;vehicle_make_model;;;Tata;.;391;;;vehicle_make_model;;;Volkswagen;.;392;;;vehicle_make_model;;;GWM;.;399;;;vehicle_make_model;;;spacesaver9;;;Andy Cab (Cape Town);;;28;;;Western Cape - Cape Town;.;53;;;Bekkers Canopy Centre (Witbank);;;41;;;Mpumalanga - Highveld;.;53;;;Bekkers Canopy Centre (Witbank);;;30;;;Mpumalanga - Lowveld;.;27;;;Bobaas Canopies (Vereeniging);;;37;;;Gauteng - Ekurhuleni Metro;.;27;;;Bobaas Canopies (Vereeniging);;;20;;;Gauteng - Joburg Metro;.;28;;;Bucco Canopies (Gauteng);;;37;;;Gauteng - Ekurhuleni Metro;.;28;;;Bucco Canopies (Gauteng);;;20;;;Gauteng - Joburg Metro;.;28;;;Bucco Canopies (Gauteng);;;24;;;Gauteng - Tshwane Metro;.;22;;;Bucco Canopies (Maritzburg);;;40;;;KwaZulu Natal - Maritzburg;.;21;;;Bucco Canopies (Pinetown);;;17;;;KwaZulu Natal - Durban;.;21;;;Bucco Canopies (Pinetown);;;40;;;KwaZulu Natal - Maritzburg;.;45;;;Bucco Canopies (Port Elizabeth);;;43;;;Eastern Cape - Buffalo City;.;45;;;Bucco Canopies (Port Elizabeth);;;18;;;Eastern Cape - Nelson Mandela;.;39;;;Bush Buck Canopies (Cape Town);;;28;;;Western Cape - Cape Town;.;23;;;Canopy and Weca Centre (Centurion);;;37;;;Gauteng - Ekurhuleni Metro;.;23;;;Canopy and Weca Centre (Centurion);;;20;;;Gauteng - Joburg Metro;.;23;;;Canopy and Weca Centre (Centurion);;;24;;;Gauteng - Tshwane Metro;.;38;;;Canopy King (Pinetown);;;17;;;KwaZulu Natal - Durban;.;38;;;Canopy King (Pinetown);;;40;;;KwaZulu Natal - Maritzburg;.;50;;;Canopy Land (Rustenburg);;;42;;;Northwest - Klerksdorp;.;50;;;Canopy Land (Rustenburg);;;42;;;Northwest - Klerksdorp;.;19;;;Canopy Workshop (Pinetown);;;17;;;KwaZulu Natal - Durban;.;19;;;Canopy Workshop (Pinetown);;;40;;;KwaZulu Natal - Maritzburg;.;34;;;Canopyman (George);;;38;;;Western Cape - George;.;35;;;Canopymart (Bellville);;;28;;;Western Cape - Cape Town;.;47;;;CC Canopies (Ermelo);;;41;;;Mpumalanga - Highveld;.;20;;;City Canopies (Durban);;;17;;;KwaZulu Natal - Durban;.;20;;;City Canopies (Durban);;;40;;;KwaZulu Natal - Maritzburg;.;8;;;Continental Canopies (Cape Town);;;28;;;Western Cape - Cape Town;.;55;;;Crestrider Canopies (Bloemfontein);;;34;;;Free State - Bloemfontein;.;55;;;Crestrider Canopies (Bloemfontein);;;39;;;Free State - Goldfields;.;54;;;Crestrider Canopies (PE);;;43;;;Eastern Cape - Buffalo City;.;54;;;Crestrider Canopies (PE);;;18;;;Eastern Cape - Nelson Mandela;.;46;;;Faaz Fit Canopy (West Rand);;;20;;;Gauteng - Joburg Metro;.;33;;;George Canopies (George);;;38;;;Western Cape - George;.;7;;;Just Canopies (Cape Town);;;28;;;Western Cape - Cape Town;.;49;;;Millenium Canopies (East Rand);;;37;;;Gauteng - Ekurhuleni Metro;.;49;;;Millenium Canopies (East Rand);;;20;;;Gauteng - Joburg Metro;.;48;;;Pikkies Canopies (Middelburg);;;41;;;Mpumalanga - Highveld;.;52;;;Puma Canopies (Nelspruit);;;30;;;Mpumalanga - Lowveld;.;51;;;Rhino Linings (Rustenburg);;;42;;;Northwest - Klerksdorp;.;51;;;Rhino Linings (Rustenburg);;;19;;;Northwest - Rustenburg;.;36;;;Roamerrand (Cape Town);;;28;;;Western Cape - Cape Town;.;43;;;Roamerrand (Polokwane);;;23;;;Limpopo - Polokwane;.;44;;;SA Canopy (Polokwane);;;23;;;Limpopo - Polokwane;.;24;;;Stingray Canopies (Cape Town);;;28;;;Western Cape - Cape Town;.;42;;;XXXXX Aero Canopies (Isando) XXXXX;;;37;;;auteng - Ekurhuleni Metro;.;42;;;XXXXX Aero Canopies (Isando) XXXXX;;;20;;;Gauteng - Joburg Metro;.;17;;;XXXXX Andy Cab (Gauteng) XXXXX;;;37;;;Gauteng - Ekurhuleni Metro;.;17;;;XXXXX Andy Cab (Gauteng) XXXXX;;;20;;;Gauteng - Joburg Metro;.;17;;;XXXXX Andy Cab (Gauteng) XXXXX;;;24;;;Gauteng - Tshwane Metro;.;32;;;XXXXX Canopy Pro (East Rand) XXXXX;;;37;;;Gauteng - Ekurhuleni Metro;.;32;;;XXXXX Canopy Pro (East Rand) XXXXX;;;20;;;Gauteng - Joburg Metro;.;31;;;XXXXX Canopy Pro (Pretoria) XXXXX;;;24;;;Gauteng - Tshwane Metro;.;13;;;XXXXX CanopyXchange (Gauteng) XXXXX;;;37;;;Gauteng - Ekurhuleni Metro;.;13;;;XXXXX CanopyXchange (Gauteng) XXXXX;;;20;;;Gauteng - Joburg Metro;.;13;;;XXXXX CanopyXchange (Gauteng) XXXXX;;;24;;;Gauteng - Tshwane Metro;.;29;;;XXXXX Club Canopies (Pretoria) XXXXX;;;24;;;Gauteng - Tshwane Metro;.;40;;;XXXXX Jimmy's Autolot (Strand) XXXXX;;;28;;;Western Cape - Cape Town;.;30;;;XXXXX Silverton Canopy Centre (Pretoria);;;24;;;Gauteng - Tshwane Metro;.;26;;;XXXXX Stingray Canopies (Durban) XXXXX;;;17;;;KwaZulu Natal - Durban;.;26;;;XXXXX Stingray Canopies (Durban) XXXXX;;;40;;;KwaZulu Natal - Maritzburg;.;25;;;XXXXX Stingray Canopies (Gauteng) XXXXX;;;37;;;Gauteng - Ekurhuleni Metro;.;25;;;XXXXX Stingray Canopies (Gauteng) XXXXX;;;20;;;Gauteng - Joburg Metro;.;25;;;XXXXX Stingray Canopies (Gauteng) XXXXX;;;24;;;Gauteng - Tshwane Metro;.;18;;;XXXXX Test Supplier One XXXXX;;;41;;;Mpumalanga - Highveld;.;41;;;XXXXX Xtreme Canopies (Randfontein);;;37;;;Gauteng - Ekurhuleni Metro;.;41;;;XXXXX Xtreme Canopies (Randfontein);;;20;;;Gauteng - Joburg Metro;.;41;;;XXXXX Xtreme Canopies (Randfontein);;;24;;;Gauteng - Tshwane Metro;.;41;;;XXXXX Xtreme Canopies (Randfontein);;;42;;;Northwest - Klerksdorp;.;41;;;XXXXX Xtreme Canopies (Randfontein);;;19;;;Northwest - Rustenburg;.;37;;;XXXXX ZZ Tops (Strand);;;28;;;Western Cape - Cape Town43;;;Eastern Cape - Buffalo City;;;3;.;18;;;Eastern Cape - Nelson Mandela;;;3;.;34;;;Free State - Bloemfontein;;;5;.;39;;;Free State - Goldfields;;;3;.;37;;;Gauteng - Ekurhuleni Metro;;;5;.;20;;;Gauteng - Joburg Metro;;;5;.;24;;;Gauteng - Tshwane Metro;;;5;.;17;;;KwaZulu Natal - Durban;;;5;.;40;;;KwaZulu Natal - Maritzburg;;;3;.;23;;;Limpopo - Polokwane;;;3;.;41;;;Mpumalanga - Highveld;;;3;.;30;;;Mpumalanga - Lowveld;;;3;.;35;;;Northern Cape - Kimberley;;;3;.;28;;;Western Cape - Cape Town;;;5;.;38;;;Western Cape - George;;;3393;;;budget;.;1;;;canopy_req and here is the salert(msg) function: // silent salertfunction salert(msg) { msg = msg.toString(); var errd = document.getElementById("errchk"); errd.innerHTML += msg.replace(/\n/g,"<br />") + "<br />"; errd.style.visibility = "visible"; errd.onclick = function () { this.style.visibility = "hidden"; this.innerHTML = " "; }} the array elements where manually wrapped so as not to break this post.however, the function seems to find elements 5, 6 and 7 to be empty, despite notifying of them in the salert function. 0osomeone please help!
  5. oh my GOD!if you look closely, you will see the for loop for those tags is as follows: for (var p = 0; p < servicedetail.attributes.length; w++) { this causes it to loop forever, "hanging" the browser. the incrementer is all wrong! it should look as follows: for (var p = 0; p < servicedetail.attributes.length; p++) { issue resolved!!
  6. well they are outside the loops in which they are used, and defined as their starting count of 0 and empty arrays... this is unfortunately not the problem.
  7. here is the abridged xml for this script (some attribute and supplier tags where removed): <service> <serviceid>1</serviceid> <servicedescription>Bakkie Canopy</servicedescription> <costperlead>20</costperlead> <duplicatedays>30</duplicatedays> <showdetails>1</showdetails> <attribute id="393" description="budget" value="R3,000 to R4,000" /> <attribute id="394" description="budget" value="R4,000 to R5,000" /> <attribute id="395" description="budget" value="R5,000 to R7,500" /> <attribute id="396" description="budget" value="R7,500 to R10,000" /> <attribute id="397" description="budget" value="R10,000 to R12,500" /> <attribute id="398" description="budget" value="R12,500 plus" /> <attribute id="1" description="canopy_req" value="new_white" /> <attribute id="2" description="canopy_req" value="new_colour_coded" /> <attribute id="11" description="canopy_req" value="pre-owned_white" /> <attribute id="12" description="canopy_req" value="pre-owned_colour_coded" /> <attribute id="400" description="canopy_style" value="spacesaver" /> <attribute id="306" description="products_description" value="Meiya" /> <attribute id="401" description="products_description" value="Single" /> <attribute id="402" description="products_description" value="Asiawing" /> <attribute id="403" description="products_description" value="Chana" /> <attribute id="405" description="products_description" value="Fiat" /> <attribute id="286" description="Requirement" value="Pre-owned - White" /> <attribute id="287" description="Requirement" value="Pre-owned - Colour-coded" /> <attribute id="288" description="Requirement" value="New - White" /> <attribute id="289" description="Requirement" value="New - Colour-coded" /> <attribute id="307" description="vehicle_make_model" value="Meiya" /> <attribute id="308" description="vehicle_make_model" value="Asiawing" /> <attribute id="309" description="vehicle_make_model" value="Chana" /> <attribute id="371" description="vehicle_make_model" value="Ford - F250" /> <attribute id="370" description="vehicle_make_model" value="Fiat" /> <attribute id="312" description="vehicle_make_model" value="DFM" /> <attribute id="313" description="vehicle_make_model" value="Kia" /> <attribute id="314" description="vehicle_make_model" value="Fiat - Strada" /> <supplier id="9" name="Andy Cab (Cape Town)" regionid="28" regionname="Western Cape - Cape Town" /> <supplier id="53" name="Bekkers Canopy Centre (Witbank)" regionid="41" regionname="Mpumalanga - Highveld" /> <supplier id="53" name="Bekkers Canopy Centre (Witbank)" regionid="30" regionname="Mpumalanga - Lowveld" /> <supplier id="27" name="Bobaas Canopies (Vereeniging)" regionid="37" regionname="Gauteng - Ekurhuleni Metro" /> <supplier id="27" name="Bobaas Canopies (Vereeniging)" regionid="20" regionname="Gauteng - Joburg Metro" /> <supplier id="28" name="Bucco Canopies (Gauteng)" regionid="37" regionname="Gauteng - Ekurhuleni Metro" /> <supplier id="28" name="Bucco Canopies (Gauteng)" regionid="20" regionname="Gauteng - Joburg Metro" /> <supplier id="28" name="Bucco Canopies (Gauteng)" regionid="24" regionname="Gauteng - Tshwane Metro" /> <supplier id="22" name="Bucco Canopies (Maritzburg)" regionid="40" regionname="KwaZulu Natal - Maritzburg" /> <supplier id="21" name="Bucco Canopies (Pinetown)" regionid="17" regionname="KwaZulu Natal - Durban" /> <supplier id="21" name="Bucco Canopies (Pinetown)" regionid="40" regionname="KwaZulu Natal - Maritzburg" /> <supplier id="45" name="Bucco Canopies (Port Elizabeth)" regionid="43" regionname="Eastern Cape - Buffalo City" /> <supplier id="45" name="Bucco Canopies (Port Elizabeth)" regionid="18" regionname="Eastern Cape - Nelson Mandela" /> <supplier id="39" name="Bush Buck Canopies (Cape Town)" regionid="28" regionname="Western Cape - Cape Town" /> <supplier id="23" name="Canopy and Weca Centre (Centurion)" regionid="37" regionname="Gauteng - Ekurhuleni Metro" /> <supplier id="23" name="Canopy and Weca Centre (Centurion)" regionid="20" regionname="Gauteng - Joburg Metro" /> <supplier id="23" name="Canopy and Weca Centre (Centurion)" regionid="24" regionname="Gauteng - Tshwane Metro" /> <supplier id="38" name="Canopy King (Pinetown)" regionid="17" regionname="KwaZulu Natal - Durban" /> <supplier id="38" name="Canopy King (Pinetown)" regionid="40" regionname="KwaZulu Natal - Maritzburg" /> <supplier id="50" name="Canopy Land (Rustenburg)" regionid="42" regionname="Northwest - Klerksdorp" /> <supplier id="50" name="Canopy Land (Rustenburg)" regionid="42" regionname="Northwest - Klerksdorp" /> <supplier id="19" name="Canopy Workshop (Pinetown)" regionid="17" regionname="KwaZulu Natal - Durban" /> <supplier id="19" name="Canopy Workshop (Pinetown)" regionid="40" regionname="KwaZulu Natal - Maritzburg" /> <supplier id="34" name="Canopyman (George)" regionid="38" regionname="Western Cape - George" /> <supplier id="35" name="Canopymart (Bellville)" regionid="28" regionname="Western Cape - Cape Town" /> <supplier id="47" name="CC Canopies (Ermelo)" regionid="41" regionname="Mpumalanga - Highveld" /> <supplier id="20" name="City Canopies (Durban)" regionid="17" regionname="KwaZulu Natal - Durban" /> <supplier id="20" name="City Canopies (Durban)" regionid="40" regionname="KwaZulu Natal - Maritzburg" /> <supplier id="8" name="Continental Canopies (Cape Town)" regionid="28" regionname="Western Cape - Cape Town" /> <supplier id="55" name="Crestrider Canopies (Bloemfontein)" regionid="34" regionname="Free State - Bloemfontein" /> <supplier id="55" name="Crestrider Canopies (Bloemfontein)" regionid="39" regionname="Free State - Goldfields" /> <supplier id="54" name="Crestrider Canopies (PE)" regionid="43" regionname="Eastern Cape - Buffalo City" /> <supplier id="54" name="Crestrider Canopies (PE)" regionid="18" regionname="Eastern Cape - Nelson Mandela" /> <supplier id="46" name="Faaz Fit Canopy (West Rand)" regionid="20" regionname="Gauteng - Joburg Metro" /> <supplier id="33" name="George Canopies (George)" regionid="38" regionname="Western Cape - George" /> <supplier id="7" name="Just Canopies (Cape Town)" regionid="28" regionname="Western Cape - Cape Town" /> <supplier id="49" name="Millenium Canopies (East Rand)" regionid="37" regionname="Gauteng - Ekurhuleni Metro" /> <supplier id="49" name="Millenium Canopies (East Rand)" regionid="20" regionname="Gauteng - Joburg Metro" /> <supplier id="48" name="Pikkies Canopies (Middelburg)" regionid="41" regionname="Mpumalanga - Highveld" /> <supplier id="52" name="Puma Canopies (Nelspruit)" regionid="30" regionname="Mpumalanga - Lowveld" /> <supplier id="51" name="Rhino Linings (Rustenburg)" regionid="42" regionname="Northwest - Klerksdorp" /> <supplier id="51" name="Rhino Linings (Rustenburg)" regionid="19" regionname="Northwest - Rustenburg" /> <supplier id="36" name="Roamerrand (Cape Town)" regionid="28" regionname="Western Cape - Cape Town" /> <supplier id="43" name="Roamerrand (Polokwane)" regionid="23" regionname="Limpopo - Polokwane" /> <supplier id="44" name="SA Canopy (Polokwane)" regionid="23" regionname="Limpopo - Polokwane" /> <wanted id="43" name="Eastern Cape - Buffalo City" amount="3" /> <wanted id="18" name="Eastern Cape - Nelson Mandela" amount="3" /> <wanted id="34" name="Free State - Bloemfontein" amount="5" /> <wanted id="39" name="Free State - Goldfields" amount="3" /> <wanted id="37" name="Gauteng - Ekurhuleni Metro" amount="5" /> <wanted id="20" name="Gauteng - Joburg Metro" amount="5" /> <wanted id="24" name="Gauteng - Tshwane Metro" amount="5" /> <wanted id="17" name="KwaZulu Natal - Durban" amount="5" /> <wanted id="40" name="KwaZulu Natal - Maritzburg" amount="3" /> <wanted id="23" name="Limpopo - Polokwane" amount="3" /> <wanted id="41" name="Mpumalanga - Highveld" amount="3" /> <wanted id="30" name="Mpumalanga - Lowveld" amount="3" /> <wanted id="35" name="Northern Cape - Kimberley" amount="3" /> <wanted id="28" name="Western Cape - Cape Town" amount="5" /> <wanted id="38" name="Western Cape - George" amount="3" /> [b]<priceattribute keyid="393" keydesc="budget" /> <priceattribute keyid="1" keydesc="canopy_req" />[/b]</service> the tags in bold are what i need to read, but if i try, the browser hangs.
  8. hi all,got a bit of a problem here... the following script crashes the browser, only if the parts in bold are included. yet they have to be there... why could this be happening? // parse services var services = xmldoc.getElementsByTagName("service"); for (var x = 0; x < services.length; x++) { var i = 0; var arr = new Array(); var aa = 0; var arr1 = new Array(); var ss = 0; var arr3 = new Array(); var wr = 0; var arr5 = new Array(); [b]var pr = 0; var arr7 = new Array();[/b] for (var c = 0; c < services[x].childNodes.length; c++) { var servicedetail = services[x].childNodes[c]; if (servicedetail.childNodes.length > 0) { if (servicedetail.firstChild.data != null) { arr[i] = servicedetail.firstChild.data; i++; } } else if (servicedetail.nodeName == "attribute") { var arr2 = new Array(); for (var a = 0; a < servicedetail.attributes.length; a++) { arr2[a] = servicedetail.attributes[a].value; } arr1[aa] = arr2.join(";;;"); aa++; } else if (servicedetail.nodeName == "supplier") { var arr4 = new Array(); for (var s = 0; s < servicedetail.attributes.length; s++) { arr4[s] = servicedetail.attributes[s].value; } arr3[ss] = arr4.join(";;;"); ss++; } else if (servicedetail.nodeName == "wanted") { var arr6 = new Array(); for (var w = 0; w < servicedetail.attributes.length; w++) { arr6[w] = servicedetail.attributes[w].value; } arr5[wr] = arr6.join(";;;"); wr++; }[b] else if (servicedetail.nodeName == "priceattribute") { var arr8 = new Array(); for (var p = 0; p < servicedetail.attributes.length; w++) { arr8[p] = servicedetail.attributes[p].value; } arr7[pr] = arr8.join(";;;"); pr++; }[/b] alert("arrays parsed "+c); } arr[i] = arr1.join(";.;"); // service attributes i++; arr[i] = arr3.join(";.;"); // service suppliers & regions i++; arr[i] = arr5.join(";.;"); // suppliers wanted per region i++; [b]arr[i] = arr7.join(";.;"); // price deduction attribute keys i++;[/b] alert("arrays joined "+x); salert(arr.join("\n")); if (arr[0]) addrecord("list_services", arr); } the xml pasted is quite lengthy (285 tags [first 5 with child text and a closing tag], in the <service> tag). the reason the arrays are joined is because this data gets stored in a new option's value attribute. there are only 2 keys at the moment but for the bakkie canopy service there will be 4 price determining keys. an attribute consists of a key and a value. the moment it runs past 0 indexed tag 564 it hangs if i include the bold lines, does not if i don't (it then ignores tag 565 and 566). that's the first <priceattribute> tag with two tag attributes. why would this be happening?
  9. hi there,the php code that generates this line is echo " <suppliergooglemapsurl>" . xmlentities( ((strlen($row["text_GoogleMapsURL"]))?$row["text_GoogleMapsURL"]:" ") ) . "</suppliergooglemapsurl>\n"; and the xml returned is <suppliergooglemapsurl>http://www.canopyxchange.za.net/andycab/;roadrunner_cpt;amGKEa75CF241s4tPAUSED</suppliergooglemapsurl> yet in when viewed in PMA, the value is http://maps.google.co.za/maps?f=q&source=s_q&hl=en... it's printing the text_VTigerData instead of text_GoogleMapsURL database fields... 0overy puzzling this phenomenon, to say the least... any ideas?
  10. actually it is for some reason - it works now and outputs the following xml: <pricecat> <catid>1</catid> <svcid>1</svcid> <catdesc>Category A</catdesc> <catprice>20</catprice> <catgroup id="1" desc="canopy_req" val=""> <validattr id="1" value="new_white"/> <validattr id="2" value="pre-owned_colour_coded"/> </catgroup> </pricecat> :)i guess it has something to do with global variables being turned on?
  11. i hear what you are saying, but i need to test something else first. you will notice some bold code in the function, these contain typos: $GLOBALS["service"] should be $GLOBALS["s"] and $row["biginit_CategoryID"] should be $row["bigint_CategoryID"] getting that variable then would be $GLOBALS["conn"], right?
  12. [b]bigint_ServiceID bigint_CategoryID bigint_GroupID[/b]1 1 1[b]bigint_AttributeID text_AttributeDescription[/b]1 canopy_req is returned by the second query tested with the values returned from the first and [b]bigint_ServiceID bigint_CombinationID bigint_CategoryID bigint_GroupID[/b]1 1 1 11 2 1 1[b]bigint_AttributeID text_AttributeValue[/b]1 new_white12 pre-owned_colour_coded is returned by the third query tested with the values returned from the second query.
  13. the values passed are valid, both service id 1 and category id 1 same as used in the test for the second mysql query, the third query being skipped due to no loop.
  14. hi again, struggling a bit to wrap my head around this one - the following function was created: function getrecords() { $sql = "SELECT 14_pricecategories.bigint_CategoryID, 14_pricecategories.text_CategoryDescription, 14_pricecategories.bigint_CategoryPrice, 2_servicescatalogue.bigint_ServiceID, 2_servicescatalogue.text_ServiceDescription FROM 14_pricecategories LEFT JOIN ( 2_servicescatalogue ) ON ( 14_pricecategories.bigint_ServiceID = 2_servicescatalogue.bigint_ServiceID ) ORDER BY 14_pricecategories.text_CategoryDescription ASC;"; $result = mysql_query_errors($sql , $conn , __FILE__ , __LINE__ , false); if ($result) { while ($row = mysql_fetch_array($result)) { echo " <pricecat>\n"; echo " <catid>".$row["bigint_CategoryID"]."</catid>\n"; echo " <svcid>".$row["bigint_ServiceID"]."</svcid>\n"; echo " <catdesc>". xmlentities($row["text_CategoryDescription"])."</catdesc>\n"; echo " <catprice>".$row["bigint_CategoryPrice"]. "</catprice>\n"; $sql0 = "SELECT 16_attributegroupings.bigint_ServiceID, 16_attributegroupings.bigint_CategoryID, 16_attributegroupings.bigint_GroupID, 3_serviceattributes.bigint_AttributeID, 3_serviceattributes.text_AttributeDescription FROM 16_attributegroupings LEFT JOIN ( 3_serviceattributes ) ON ( 16_attributegroupings.bigint_AttributeKeyID = 3_serviceattributes.bigint_AttributeID ) WHERE 16_attributegroupings. bigint_ServiceID = ".$GLOBALS["[b]service[/b]"]." AND 16_attributegroupings. bigint_CategoryID = ".$row["[b]biginit_CategoryID[/b]"]." ORDER BY 3_serviceattributes.text_AttributeDescription ASC;"; $result0 = mysql_query_errors($sql0 , $conn , __FILE__ , __LINE__ , false); if ($result0) { while ($row0 = mysql_fetch_array($result0)) { echo " <catgroup id=\"". $row0["bigint_GroupID"]."\" desc=\"". $row0["text_AttributeDescription"]. "\" val=\"".$row0["text_AttributeValue"]. "\">\n"; $sql1 = "SELECT 15_validcombinations.bigint_ServiceID, 15_validcombinations.bigint_CombinationID, 15_validcombinations.bigint_CategoryID, 15_validcombinations.bigint_GroupID, 3_serviceattributes.bigint_AttributeID, 3_serviceattributes.text_AttributeValue FROM 15_validcombinations LEFT JOIN ( 3_serviceattributes ) ON ( 15_validcombinations. bigint_AttributeValueID = 3_serviceattributes. bigint_AttributeID ) WHERE 15_validcombinations. bigint_ServiceID = ".$GLOBALS["[b]service[/b]"]." AND 15_validcombinations. bigint_CategoryID = ".$row0["[b]biginit_CategoryID[/b]"]." AND 15_validcombinations. bigint_GroupID = ".$row0["bigint_GroupID"]." ORDER BY 3_serviceattributes.text_AttributeValue ASC;"; $result1 = mysql_query_errors($sql1 , $conn , __FILE__ , __LINE__ , false); if ($result1) { while ($row1 = mysql_fetch_array($result1)) { echo " <validattr id=\"". $row1["bigint_CombinationID"]. "\" value=\"". $row1["text_AttributeValue"]. "\"/>\n"; } } echo " </catgroup>\n"; } mysql_free_result($result0); } echo " </pricecat>\n"; } mysql_free_result($result); }} running the sql queries in pma, they get the valid values they are supposed to have. a testing group, and the second select statement the values of that group. however in php they are not displayed? 0oi will need to figure out what the values are that are being parsed.
  15. thanks for being so patient with me, justsomeguy i will get Putty and try it out...at the moment there are more urgent issues however that need attending to.
  16. hi again.the reason i am posting the following two questions here, is that i cannot seem to find any related solutions on the web.i need to modify a query i previously ran to select the leads, but this time output the attributes to columns. now the problem lies with the two types of leads, having different attributes - as can be seen by the following examples: and sofar i have compiled the following query, but i need to know how would something in this line be possible?obviously they need to follow the same column naming convention, but one of the two has a few attributes split and vice versa.one can't seem to select multiple columns in an if else clause.i guess i would have to identify the fields and compile them as such.also, been wondering wether one can create a column name dynamically as i have tried previously.SELECT IF INSTR(6_serviceleads.text_LeadAttributes,'canopy_req = ') > 0 THEN ( SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',1),' = ',-1) AS `Canopy Requirement`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',2),';',-1),' = ',-1) AS `Canopy Style`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',3),';',-1),' = ',-1) AS `Budget`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',4),';',-1),' = ',-1) AS `Fitment`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',5),';',-1),' = ',-1) AS `Vehicle Status`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',6),';',-1),' = ',-1) AS `Vehicle Make Model`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',7),';',-1),' = ',-1) AS `Year Model` ) ELSE ( SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',1),' = ',-1) AS `Products Description`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',2),';',-1),' = ',-1) AS `Bakkie Model`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',3),';',-1),' = ',-1) AS `Requirement`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',4),';',-1),' = ',-1) AS `Colour Code`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',5),';',-1),' = ',-1) AS `Budget`, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_LeadAttributes,'<br />',6),';',-1),' = ',-1) AS `Fitment` ) END IF SUBSTRING_INDEX(6_serviceleads.text_Consumer,';',1) AS `Consumer Name`, SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_Consumer,';',2),';',-1) AS `Consumer E-mail`, SUBSTRING_INDEX(SUBSTRING_INDEX(6_serviceleads.text_Consumer,';',3),';',-1) AS `Consumer Telephone`, 1_regions.text_RegionDescription AS `Consumer Region`, SUBSTRING_INDEX(6_serviceleads.text_Consumer,';',-1) AS `Consumer City/Town`, 6_serviceleads.timestamp_LeadCreated AS `Lead Created`, IF(6_serviceleads.tinyint_LeadSent = 1,'TRUE','FALSE') AS `Lead Sent`, 5_suppliers.text_SupplierName AS `Supplier`, 2_servicescatalogue.text_ServiceDescription AS `Service` FROM 6_serviceleads LEFT JOIN 1_regions ON ( 6_serviceleads.bigint_RegionID = 1_regions.bigint_RegionID) LEFT JOIN 5_suppliers ON ( 6_serviceleads.bigint_SupplierID = 5_suppliers.bigint_SupplierID) LEFT JOIN 2_servicescatalogue ON ( 6_serviceleads.bigint_ServiceID = 2_servicescatalogue.bigint_ServiceID) ORDER BY `Lead Created` DESC; can't seem to find answers to either of these questions, tried two search engines sofar - and it's getting late...
  17. as i said, i am not that experienced with crontasks.however, i tested this line with the correct username and password - and received the following output from the server in mail: Error in argument 1, char 2: option not found rUsage: php [-q] [-h] [-s] [-v] [-i] [-f <file>] php <file> [args...] -a Run interactively -C Do not chdir to the script's directory -c <path>|<file> Look for php.ini file in this directory -n No php.ini file will be used -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -f <file> Parse <file>. Implies `-q' -h This help -i PHP information -l Syntax check only (lint) -m Show compiled in modules -q Quiet-mode. Suppress HTTP Header output. -s Display colour syntax highlighted source. -v Version number -w Display source with stripped comments and whitespace. -z <file> Load Zend extension <file>.
  18. hang on, let me check if the database has the localhost allowed or denied access to use the database... :)okay the database access list had %localhost in so i added a %localhost% and 127.0.0.1. will see tomorrow at 7am what happens regarding the script i can't run it any other time because these scripts send mails out to the suppliers and they get duplicates. i think that might be the solution to the problem
  19. i am afraid i do have a clue which command line cPanelX uses for running cronjobs... it's an html based site which one administrates through.the error handling is set to default on the apache server to DISPLAY_ALL. i would be taking a wild guess if i was to assume that it's the apache console these cronjobs are run through.here's a screenshot of the cronjobs as they have been set up since before the errors started (after the host moved to upgraded servers).cPanel X cronjobs.below are the files used as cronjobs (reminders and cannopyxchange): <?PHP/*CANOPYXCHANGE BRANDED EXPIRED TRIAL SUPPLIERS NOTIFICATIONVersion 2.0.1*/include("/home/dwtphovu/public_html/ferrety/fab/includes/content/dwtphovu_f3rr37y.php");include("/home/dwtphovu/public_html/ferrety/fab/includes/mailer/class.phpmailer.php"); // include PHPMailer class$sql = "SELECT text_SupplierName, text_ContactFirstName, text_ContactSurname, `text_ContactE-mail`, CURRENT_TIMESTAMP AS timestamp_Current FROM 5_suppliers WHERE smallint_SupplierStatus = 2 AND CURRENT_TIMESTAMP > timestamp_DateEnd";$result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ , false);$logourl = "http://www.canopyxchange.za.net/canopyxchange.gif";if ($result) { while ($row = mysql_fetch_array($result)) { $suppliers .= "<strong>".$row["text_SupplierName"]."</strong> - ".$row["text_ContactFirstName"]." ".$row["text_ContactSurname"]." (".$row["text_ContactE-mail"].")<br />\n"; $timestamp = $row["timestamp_Current"]; }}if (strlen($suppliers) > 0) { $body = getFile("/home/dwtphovu/public_html/ferrety/fab/templat/reminder.html"); // load mail template $mail = new PHPMailer(); // create a new object $body = str_replace("%LOGOURL%",$logourl,$body); // insert logo url $body = str_replace("%TIMESTAMP%",$timestamp,$body); // insert logo url $body = str_replace("%SUPPLIERS%",$suppliers,$body); // insert suppliers still prospecting $body = str_replace("%COPYRIGHT%","CanopyXchange",$body); // insert copyright owner $body = str_replace("%YEAR%",date("Y"),$body); // insert copyright year require("/home/dwtphovu/public_html/ferrety/fab/includes/mailer/dwtphovu_auth.php"); // include mailer auth $mail->From = "canopy@canopyxchange.za.net"; // set from email $mail->FromName = "CanopyXchange"; // set from name $mail->Subject = getSubText($body,"<title>","</title>"); // set subject to template page title $mail->AddBCC("pierre@greywacke.co.za","Pierre \"Greywacke\" du Toit"); // add the developer to the BCC list $mail->ClearAttachments(); // clears attachments $mail->MsgHTML($body); // set HTML Body $mail->AltBody = strip_tags(html_entity_decode(getSubText($body, // set Text Body "<body>","</body>"))); $mail->AddAddress("jaap.venter@ananzi.co.za", "Jaap Venter"); // add recipient $mail->IsHTML(true); // set send as HTML $mail->Send(); // if attempt sending failed}//echo mysql_real_escape_string((count($sql)>0)?join("\n",$sql):"");mysql_close($conn);?> <?PHP/*CANOPYXCHANGE BRANDED CREDIT LIMIT SUPPLIER NOTIFICATIONVersion 2.0.1*/include("/home/dwtphovu/public_html/ferrety/fab/includes/content/dwtphovu_f3rr37y.php");include("/home/dwtphovu/public_html/ferrety/fab/includes/mailer/class.phpmailer.php"); // include PHPMailer class$sql = "SELECT * FROM 5_suppliers WHERE bigint_CurrentBalance <= smallint_CreditUpperLimit AND bigint_CurrentBalance > smallint_CreditLowerLimit AND smallint_SupplierStatus = 0";$result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ , false);$logourl = "http://www.canopyxchange.za.net/canopyxchange.gif";if ($result) { while ($row = mysql_fetch_array($result)) { $body = getFile("/home/dwtphovu/public_html/ferrety/fab/templat/cronjob.html"); // load mail template $recipient = $row["text_ContactFirstName"]." ".$row["text_ContactSurname"]; // get contact name $recipientemail = $row["text_ContactE-mail"]; // get contact e-mail $message = $row["text_CreditUpperMsg"]; // get suppliers upper limit message $balance = $row["bigint_CurrentBalance"]; // get suppliers current balance $limit = "UPPER"; // set limit message $mail = new PHPMailer(); // create a new object $body = str_replace("%CONTACTNAME%",$recipient,$body); // insert contact name $body = str_replace("%BALANCE%",$balance,$body); // insert supplier balance $body = str_replace("%LIMIT%",$limit,$body); // insert limit type $body = str_replace("%MESSAGE%",$message,$body); // insert message $body = str_replace("%LOGOURL%",$logourl,$body); // insert logo url $body = str_replace("%COPYRIGHT%","CanopyXchange",$body); // insert copyright owner $body = str_replace("%YEAR%",date("Y"),$body); // insert copyright year require("/home/dwtphovu/public_html/ferrety/fab/includes/mailer/dwtphovu_auth.php"); // include mailer auth $mail->From = "canopy@canopyxchange.za.net"; // set from email $mail->FromName = "CanopyXchange"; // set from name $mail->Subject = getSubText($body,"<title>","</title>"); // set subject to template page title $mail->AddBCC("pierre@greywacke.co.za", "Pierre \"Greywacke\" du Toit"); // add the developer to the BCC list $mail->AddBCC($row["text_AccMgrE-mail"], $row["text_AccMgr"]); // add the owner to the BCC list $mail->ClearAttachments(); // clears attachments $mail->MsgHTML($body); // set HTML Body $mail->AltBody = strip_tags(html_entity_decode(getSubText($body, // set Text Body "<body>","</body>"))); $mail->AddAddress($recipientemail,$recipient); // add recipient $mail->IsHTML(true); // set send as HTML $mail->Send(); // attempt sending }}$sql = "SELECT * FROM 5_suppliers WHERE bigint_CurrentBalance <= smallint_CreditLowerLimit AND smallint_SupplierStatus = 0";$result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ , false);if ($result) { while ($row = mysql_fetch_array($result)) { $body = getFile("/home/dwtphovu/public_html/ferrety/fab/templat/cronjob.html"); // load mail template $recipient = $row["text_ContactFirstName"]." ".$row["text_ContactSurname"]; // get contact name $recipientemail = $row["text_ContactE-mail"]; // get contact e-mail $message = $row["text_CreditLowerMsg"]; // get suppliers upper limit message $balance = $row["bigint_CurrentBalance"]; // get suppliers current balance $limit = "LOWER"; // set limit message $mail = new PHPMailer(); // create a new object $body = str_replace("%CONTACTNAME%",$recipient,$body); // insert contact name $body = str_replace("%BALANCE%",$balance,$body); // insert supplier balance $body = str_replace("%LIMIT%",$limit,$body); // insert limit type $body = str_replace("%MESSAGE%",$message,$body); // insert message $body = str_replace("%LOGOURL%",$logourl,$body); // insert logo url $body = str_replace("%COPYRIGHT%","CanopyXchange",$body); // insert copyright owner $body = str_replace("%YEAR%",date("Y"),$body); // insert copyright year require("/home/dwtphovu/public_html/ferrety/fab/includes/mailer/dwtphovu_auth.php"); // include mailer auth $mail->From = "canopy@canopyxchange.za.net"; // set from email $mail->FromName = "CanopyXchange"; // set from name $mail->Subject = getSubText($body,"<title>","</title>"); // set subject to template page title $mail->AddBCC("pierre@greywacke.co.za", "Pierre \"Greywacke\" du Toit"); // add the developer to the BCC list $mail->AddBCC($row["text_AccMgrE-mail"], $row["text_AccMgr"]); // add the owner to the BCC list $mail->ClearAttachments(); // clears attachments $mail->MsgHTML($body); // set HTML Body $mail->AltBody = strip_tags(html_entity_decode(getSubText($body, // set Text Body "<body>","</body>"))); $mail->AddAddress($recipientemail,$recipient); // add recipient $mail->IsHTML(true); // set send as HTML $mail->Send(); // attempt sending }}//echo mysql_real_escape_string((count($sql)>0)?join("\n",$sql):"");mysql_close($conn);?> okay i believe on closer inspection these cronjobs run in the *nix command line (unix).
  20. okay, i know the connect include works, because it works on all the other pages of the site that use it without these errors.only the cronjobs started generating these errors since they've upgraded the server. the errors are being generated with the cronjobs. i am not that familiar with cronjobs, i am quite sure they might not have adjusted some setting that refuses include top level variables to persist outside the include (in the calling PHP document).the cronjobs do connect and retrieve variables (i know this because i receive a BCC of the intended mails), despite throwing these errors to the mail address set to receive them in cPanel X.unfortunately i cannot udjust the settings - only the hosting administrators can...yes that is one line in the connection include. to connect with the username and password set on the database in cPanelX. there is only one include - the connection include, and its the include which is spitting these warnings only from the cronjobs.
  21. lol found the prob ^^its pcn.attributes.length if i want to use it like that :)so i changed it to pcn.attributes ^^ussue RESOLVED
  22. hi all,got this slight issue, tried various scripting layouts, but none of them work. when i started, at first just got only the subarray 4 (catattr node attributes 0 - 3)...here is the xml: <?xml version="1.0" encoding="UTF-8" ?><root> <pricecat> <catid>1</catid> <svcid>1</svcid> <catdesc>Category A</catdesc> <catprice>20</catprice> <catattr id="1" desc="canopy_req" val="new_white"/> </pricecat> <sql></sql></root> and here is the parser, followed by the dhtml that is supposed to create a new list option. with the passed array. // get category informationvar pricecat = xmldoc.getElementsByTagName("pricecat");for (var r = 0; r < pricecat.length; r++) { var i = 0; var len = (parseInt(pricecat[r].childNodes.length - 1) / 2) + 1; var arr = new Array(len); for (var c = 0; c < pricecat[r].childNodes.length; c++) { var pcn = pricecat[r].childNodes[c]; if (pcn.childNodes.length > 0) { arr[i] = pcn.firstChild.data; i++; } else if (pcn.attributes > 0) { arr[i] = new Array(2); for (a = 0; a < pcn.attributes.length; a++) { arr[i][a] = pcn.attributes[a].value; } i++; } } //salert(arr); addrecord(arr);}// skip irrelevant scripting// *******************// addrecord functionfunction addrecord(arr) { for (i = 0; i < arr.length; i++) { if (arr[i] instanceof Array) { arr[i] = arr[i].join(";;;"); } } alert(arr.join(";;")); var opt = document.createElement('option'); opt.text = arr[2] + "\u00a0\u00a0\u00a0\u00a0\u00a0(" + // category description arr[3] + ")"; // category lead price opt.value = arr.join(";;"); // save array as value var sel = document.getElementById("list_categories"); try { sel.add(opt, null); // standards compliant; doesn't work in IE } catch(ex) { sel.add(opt); // IE only }} with this, it adds the record fine, but the value does not include the joined subarray from the catattr function :/could somebody please help! afraid i can't see the bees for their honey
  23. i believe it's likely that too stringent security measures were included with cronjobs. i have made arrangements to let the hosting provider know about this. they recently upgraded their servers and these errors have only started since then.
  24. xml 1.0 cannot read all named entities in firefox. nor decimal NCR's. i can only seem to pass hexadecimal NCR's while i wait for the server to be set up for UTF-8.
×
×
  • Create New...