Sorry it does sound a bit confusing. I have attached the 2 text files. The actual end result is that I want to merge the 2 files into an xml output.
Each file has a pipe symbol as the delimter and a ^ to determine the end of line, This is needed as it just so happens that during the record there is sometimes a cr/lf so we have put the ^ to denote end of line.
The first text file contains the following fields
property_ref
location
price
main_image
bullet1
bullet2
bullet3
bullet4
bullet5
bullet6
bullet7
bullet8
In the first file you will only ever get out one record for each property_ref
The second text file contains the following fields
property_ref
internal_image
You will notice when looking in this text file that the same property ref can appear more than once. If ia property has more than 1 internal picture it will output the record again on the next line.
So, what I need to do is read in the first text file then read in the 2nd text file and where the property_ref matches the first file to add the internal image(s) onto that record.
I am totally confused on this one as the 2nd file is transactional I suppose and I don't know how to match things in an array that already exist
The ultimate output that I would like would be
<properties>
<property>
<property_ref>abc123</property>
<location>luton</location>
<price>£98,999</price>
<main_image>main.jpg</main_image>
<bullet1>1</bullet1>
<bullet2>2</bullet2>
<bullet3>3</bullet3>
<bullet4>4</bullet4>
<bullet5>5</bullet5>
<bullet6>6</bullet6>
<bullet7>7</bullet7>
<bullet8>8</bullet8>
<internal1>internal1.jpg</internal1>
<internal2>internal2.jpg</internal2>
</property>
</properties>
In the above example there would have been 2 records in the 2nd text file called abc123, hence the 2 internal pics. The amount of internal pics has no fixed limit so as the next one is found we weould need to increment the internal tag by one for each internal found for that property.
It would go back to <internal1> for the next property.
I have spent ages trying to work this out. I woulde be so grateful if you could help me out.
I have also attached to php files that I have created that produced the xml perfectly in two seperate files though.
If you run prop-file.php you will see that it will produce 2 seperate xml files. test.php is my very bad attempt at trying to do what I have described above
One thing that you will notice in my prop-file php script I removed spaces from the beginning and ends of the fields plus got rid of the s,c at the end of the image lines. I would still need to do this.