Jump to content

bijukon

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by bijukon

  1. Hi Would be grateful for a review of the code above, I'm altered the code yet still not getting correct figures. Thanks again
  2. Hi I've been working on a script that goes through an xml feed that contains property data. I've got most of the property details being collected correctly, however I'm struggling with getting some particulars (such as number of bathroom). The problem for me is that I need to tally up all the bathrooms (type=8) and showerooms (type=13). Some properties don't always have this data, so in such instances I take the number of bedrooms divided by 3 (result being rounded up). The issue I'm getting is that I can't reliably get an accurate number of total bathrooms & Showerrooms, which I can pass out to the main section. The results vary from accurate to quite a bit out especially if a particular type is listed more than once to indicate multiple rooms, as this feed lists rooms varyingly. e.g. type 13 may be listed 2 or 3 times (with number being 1 in each case). any advice appreciated. My code for this section is: foreach($advert->roomsList->room as $rooms) { if ($rooms->type=="1") { $bedrooms=$rooms->number; } if ($rooms->type=="8") { $bathroom=$rooms->number; } if ($rooms->type=="13") { $showerroom=$rooms->number; } } The data is presented as follows <estate id="xxxxxx" type="1"> <reference>286834349</reference> <mandate_num>1810</mandate_num> <mandate_type>1</mandate_type> <roomsList> <room id="3948806" rank="1"> <type>1</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>3</number> <coating></coating> <floor></floor> </room> <room id="3948807" rank="2"> [b]<type>13</type>[/b] <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> [b]<number>1</number>[/b] <coating></coating> <floor></floor> </room> <room id="3948808" rank="3"> [b]<type>13</type>[/b] <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> [b] <number>1</number>[/b] <coating></coating> <floor></floor> </room> <room id="3948809" rank="4"> [b]<type>8</type>[/b] <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> [b]<number>1</number>[/b] <coating></coating> <floor></floor> </room> <room id="3948810" rank="5"> <type>30</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>1</number> <coating></coating> <floor></floor> </room> <room id="3948811" rank="6"> <type>1</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>1</number> <coating></coating> <floor></floor> </room> <room id="3948812" rank="8"> <type>1</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>1</number> <coating></coating> <floor></floor> </room> <room id="3948813" rank="9"> <type>10</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>1</number> <coating></coating> <floor></floor> </room> <room id="3948814" rank="10"> <type>41</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>1</number> <coating></coating> <floor></floor> </room> <room id="3948815" rank="11"> <type>29</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>1</number> <coating></coating> <floor></floor> </room> <room id="3948816" rank="12"> <type>1</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>1</number> <coating></coating> <floor></floor> </room> <room id="3948817" rank="13"> <type>18</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>1</number> <coating></coating> <floor></floor> </room> <room id="3948818" rank="7"> <type>43</type> <comment lang="fr_FR"><![CDATA[]]></comment> <area></area> <number>1</number> <coating></coating> <floor></floor> </room> </roomsList> </estate> Thanks in advance for the help. EDIT: it helps a lot when you put your code in tags
  3. Thank you very much Maq & MadTechie I've now managed to extract the data as mentioned, I'm using the Medtechie's suggestions as that works with my script without major rewrite, but thanks for the heads up on the Dom Xpath method, I'll certainly remember to consider using it. Thanks again folks.
  4. Hi all I'm using simplexml to read xml files in to my database, normally getting xml data is pretty straightforward. I'm having trouble however trying to get data for when it is formatted in the following way: <comments> <comment lang="fr_FR"><![CDATA[lalalalalalalalalalallala]]></comment> <comment lang="en_GB"><![CDATA[hello english descriptions]]></comment> <comment lang="de_DE"><![CDATA[yayayayayayay]]></comment> <comment lang="it_iT"><![CDATA[]]></comment> <comment lang="es_ES"><![CDATA[]]></comment> <comment lang="ru_RU"><![CDATA[]]></comment> <comment lang="no_NO"><![CDATA[]]></comment> </comments> I normally extract data $variable = $advert->reference. I'm having trouble extracting en_gb data. Any guidance would be appreciated. Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.